Re: Access can't find the field referenced in your expression
- From: MGFoster <me@xxxxxxxxxxx>
- Date: Fri, 24 Apr 2009 13:44:41 -0700
MPS wrote:
I have a main form "Main" and a sub form "Sub" - the subform contains
a list of relevant documents that I might want to associate with a
record in the form on Main. These documents are contained in a table
and include a field that has a hyperlink to them.
I'm trying to use the AfterUpdate event - after the user selects a
document from the dropdown list, I want the form to automatically copy
in the hyperlink.
Private Sub Document_AfterUpdate()
Dim stDocName As String
Dim stLinkCriteria As String
'[fx-get document] is a form created just for accessing the
documents in their table
stDocName = "fx - get document"
stLinkCriteria = "[evTitle]=" & "'" & Me![Evidence] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Dim doc_location As String
'DM_Other_Location contains the hyperlink <<<< it breaks here
- can't find DM_Other_Location
doc_location = Forms![fx - get document]!DM_Other_Location.Text
DoCmd.Close
'Now put the hyperlink into the desired field
Forms![analysis-document subform]!Location.SetFocus
Forms![analysis-document subform]!Location.Text = doc_location
End Sub
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Make sure you're spelling the control's name correctly. I just copy the
name from the Control's Name property and paste it into my VBA code to
be sure. You don't need to use the .Text property when assigning a
value to the control. In Access VBA the default is .Value. The .Text
property is the display field of the control.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBSfIktYechKqOuFEgEQJRUgCggcYi8ef5nzTP7uxWbejIf9kbA3AAoJWx
NXNHo/LX0NPxaU2tnimFugLc
=vNa3
-----END PGP SIGNATURE-----
.
- Follow-Ups:
- References:
- Prev by Date: Re: Remove a comma programmatically
- Next by Date: Re: Remove a comma programmatically
- Previous by thread: Access can't find the field referenced in your expression
- Next by thread: Re: Access can't find the field referenced in your expression
- Index(es):
Relevant Pages
|