View Full Version : Access can't find the field | referred to in your expression


Dazza666
12-09-2008, 08:22 AM
Hi,

can someone tell me whats wrong with the below statement,

DoCmd.OpenForm "ClientOverview", , , "[txtNINO]=" & [Me]![NINO]

i've compared it to other ones in my database but with this one, access keeps generating the error in the title??? i've checked the field names time and time again but can't find anything wrong.



thanks

pbaldy
12-09-2008, 08:29 AM
If the data type of the field is text, it would need to be

DoCmd.OpenForm "ClientOverview", , , "[txtNINO]='" & [Me]![NINO] & "'"

Dazza666
12-09-2008, 11:59 PM
If the data type of the field is text, it would need to be

DoCmd.OpenForm "ClientOverview", , , "[txtNINO]='" & [Me]![NINO] & "'"

Hi thanks for the response, but it still gives me the same error even after I adjusted it

Also, i've put the following in to a MACRO with the open form action to try and get the same result

"txtNINO='" & [NINO] & "'"

the form opens successfully but ignores the above where condition. it's like it doesn't even bother checking it?

gemma-the-husky
12-10-2008, 05:34 AM
isthere a field "txtnino" in the form (or in the form's query - not sure which)

does [nino] have a value in the current form

also try adding spaces around the = sign

"txtNINO = '" & [NINO] & "'"

Dazza666
12-10-2008, 05:41 AM
isthere a field "txtnino" in the form (or in the form's query - not sure which)

does [nino] have a value in the current form

also try adding spaces around the = sign

"txtNINO = '" & [NINO] & "'"

Hey,

i've kinda got it working, it seems to work if the form is already open so since it is used to search the main form I made it a modal/popup form that can be opened from within the main form i'm trying to query, it seems to work ok like this

cheers