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

Referencing a form variable in VB code

Status
Not open for further replies.

FrancieFL

Technical User
Mar 3, 2003
20
0
0
US
I have an unbound field called "[Initials In]" which I am trying to us in a SELECT and SET statement. I have tried "ME![Initials IN]" but VB doesn't seem to get the value of the field.

My sub statement is:
Public Sub GetNumber_Click()

and the WHERE statement is:
"WHERE (Left([Customer_Code],2)=Me![Initials_In]); "

Is this not the correct way to reference the variable?

Is there and instruction that I can put in my VB code that will allow me to display the value of my variable, for testing purposes?

Sorry for all the questions, but I am new to Access.
Francie
 
Try:

"WHERE (Left([Customer_Code],2)='" & Me![Initials_In] & "'); "
 
To display the value for testing, you could do

msgbox Me![Initials_In]

or just put a breakpoint on that line and use the immediate or watch windows.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top