dbTalk Databases Forums  

Access can't find the field referenced in your expression

comp.databases.ms-access comp.databases.ms-access


Discuss Access can't find the field referenced in your expression in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
MPS
 
Posts: n/a

Default Access can't find the field referenced in your expression - 04-24-2009 , 09:14 AM






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

Reply With Quote
  #2  
Old   
MGFoster
 
Posts: n/a

Default Re: Access can't find the field referenced in your expression - 04-24-2009 , 03:44 PM






MPS wrote:
Quote:
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/AwUBSfIktYechKqOuFEgEQJRUgCggcYi8ef5nzTP7uxWbejIf9 kbA3AAoJWx
NXNHo/LX0NPxaU2tnimFugLc
=vNa3
-----END PGP SIGNATURE-----


Reply With Quote
  #3  
Old   
MPS
 
Posts: n/a

Default Re: Access can't find the field referenced in your expression - 04-24-2009 , 05:24 PM



I hope this isn't a silly next comment - is it significant that the
actual name of the field I"m trying to access is "DM/Other
Location" ? It was Access that gave me the DM_Other_Location syntax.

On Apr 24, 4:44*pm, MGFoster <m... (AT) privacy (DOT) com> wrote:
Quote:
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/AwUBSfIktYechKqOuFEgEQJRUgCggcYi8ef5nzTP7uxWbejIf9 kbA3AAoJWx
NXNHo/LX0NPxaU2tnimFugLc
=vNa3
-----END PGP SIGNATURE------ Hide quoted text -

- Show quoted text -


Reply With Quote
  #4  
Old   
MGFoster
 
Posts: n/a

Default Re: Access can't find the field referenced in your expression - 04-24-2009 , 08:02 PM



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use the actual name and put square brackets around it:

[DM/Other Location]

Access doesn't like punctuation and spaces in object names (like
Controls). It will substitute underscore characters when translating to
something it is going to use (like the name of a procedure).

HTH,
--
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/AwUBSfJhMoechKqOuFEgEQJaFgCgqh3c7a+iZKaW+l2+LaXjaX BITPcAoP+W
d1piScdxEVKcOAN+Gak+nQ3f
=FgRO
-----END PGP SIGNATURE-----

MPS wrote:
Quote:
I hope this isn't a silly next comment - is it significant that the
actual name of the field I"m trying to access is "DM/Other
Location" ? It was Access that gave me the DM_Other_Location syntax.

On Apr 24, 4:44 pm, MGFoster <m... (AT) privacy (DOT) com> wrote:
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/AwUBSfIktYechKqOuFEgEQJRUgCggcYi8ef5nzTP7uxWbejIf9 kbA3AAoJWx
NXNHo/LX0NPxaU2tnimFugLc
=vNa3
-----END PGP SIGNATURE------ Hide quoted text -

- Show quoted text -


Reply With Quote
  #5  
Old   
paii, Ron
 
Posts: n/a

Default Re: Access can't find the field referenced in your expression - 04-27-2009 , 10:49 AM




"MPS" <snyder.matt (AT) gmail (DOT) com> wrote

Quote:
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
It looks from your code that you are copying the hyperlink from one table to
another. What happens when the hyperlink changes? Someone will need to
update the link in 2 or more locations. If the hyperlink table has an index
field, you could copy only the index and use that to show the hyperlink in
your subform.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.