Referencing string value in SQL Access 2007

npatil

Registered User.
Local time
Today, 22:15
Joined
Mar 4, 2011
Messages
39
Hello Guys,

I have the foll statement:

If (Me.cmb_firststage = "1st Stage Drum" And Me.cmb_firststage_elements = "shoulder contur or EST" And Len(Nz(cmb_firststage_elements_values, "") > 0)) Then
strwhere = "WHERE ((
  • .[Field11])= txtvalue);"

    Here, txtvalue=Me.cmb_firststage_elements_values, and have defined txtvalue as string.

    Now, whenever I execute this code, the txtvalue does not contain the value got from Me.cmb_firststage_elements_values in another private sub procedure.

    How do I directly reference the value, so that the user does not have to manually type the value to get the results ?

    I have tried putting txtvalue in quotes, and have used Me. and Me! , but none seem to work.

    thnks in advance,

    Nik
 
The reference to the txtValue variable needs to be outside of the string (in other words - not inside the quotes) for your where condition. That way the actual value of the variable is retrieved and inserted into your string;

strwhere = "WHERE ((
  • .[Field11])= """ & Me!txtvalue & """);"
 

Users who are viewing this thread

Back
Top Bottom