Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query won't reference form...HELP!!

Status
Not open for further replies.

danomaniac

Programmer
Jan 16, 2002
266
US
Okay gang. I'm STUCK!!

I built a database query that pulls a criteria from a form. Yesterday, it worked fine. Today, I get an error that says, "The Microsoft Jet Engine Database does not recognize '[Forms]![frmName]![Text1]' as a valid field name or expression.

I have used another query to reference this text box and I have referenced another text box with this query and both work. But when I reference this box with this query I get the error. Any Ideas? thanks.

 
A problem with pulling values for the criteria in a query is that there is no way of determining whether the form is actually open. You could build a function to get the value of Text1 only if the form was open and return it to the query.

If IsOpen("frmName") Then
strReturn = Forms("frmName").Text1
Else
MsgBox "The form is not open"
End If

I used the shortcut function 'IsOpen' but you can also check with SysCmd.

Otherwise, when you get your error go to the immediate window and paste in:
?[Forms]![frmName]![Text1]
to see what type of error it gives you.
----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top