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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

invalid field name or expresstion 1

Status
Not open for further replies.

jmnekrkt

Programmer
Feb 21, 2002
47
US
the following code is in two reports

If Forms![misc reports].chkSelectSection = -1 Then
Me.Filter = "unit = forms![misc reports].txtSection"
Me.FilterOn = True
Else
Me.FilterOn = False
End If

In one report, the filter allows only the selected section to print. In the other report, I receive the error

"The microsoft jet engine does not recognize 'forms![misc reports].txtSection' as a valid field name or expression".

If I manually enter the text value and turn on the filter it works. It just will not read it from the other form.

Any suggestions???

Thank you
 
Assuming the [misc reports] form is open at the time and that Unit takes a text value, try:

Code:
If Forms![misc reports].chkSelectSection Then Me.Filter = "unit = ' " & forms![misc reports].txtSection & "'"
Me.FilterOn = Forms![misc reports].chkSelectSection

As you can see, I've also done a little code streamlining. HTH. [pc2]
 
You are the best. Worked perfectly. I had to change the unit to numeric...somewhere along the series of queries, it became a number...but that was all. Took me a minute to figure out you were using the check box for the FilterOn true/false. I like it.

Thank you Thank you Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top