Can't find field. Error 2465

kirkm

Registered User.
Local time
Today, 22:36
Joined
Oct 30, 2008
Messages
1,257
From a button click event I'm trying to debug print the value of a field
Code:
debug.print Form_frmList!FileSpec
If I put a Stop in the code and paste that line into the immediate window there is not error and the correct value is shown.
Why does it go to error in the click event ?
The field does exist in the query the Form is based on, but there is no control for that field on the Form. But this is true for some other fields in the query yet I can debug.print them.
 
Hi. Is the button on frmList or a different form?
 
The button is on the Main Form and frmlist is there also but as a datasheet. A subForm? (this confuses me a bit)
 
The button is on the Main Form and frmlist is there also but as a datasheet. A subForm? (this confuses me a bit)

What is the name of the main form?
 
Debug.Print Me.filespec if on the same form

Or

Debug.Print Forms!frmList.FileSpec if on another form

Or

Debug.Print Me.frmList.Form.FileSpec if on a subform
 
Last edited:
Many thanks for the replies. I'm sorry this is the sort of thing that drives me crazy. I've spent over 2 hours on this and suddenly it starts working. I've done nothing to fix it.


Trying Colins examples here doesn't seem to work. Is this a clue of some kind?

Debug.Print Forms!frmList.FileSpec
error 2450 Microsoft Access cannot find the referenced form 'frmList'.
Debug.Print Me.frmList.Form.FileSpec
Method or data member not found (with .frmList highlighted)


Debug.Print Form_frmList!FileSpec
This is now working every time.
 

Users who are viewing this thread

Back
Top Bottom