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!

Using Variables in a query

Status
Not open for further replies.

gary1

Technical User
Aug 6, 2002
5
Hi,

I need to set a variables value using an input box, then run a query using the value entered. I would also like the value stored in the variable to use on another query. Is this possible and how would I go about it.

Appreciate any help.
 
Hi Gary,

You are not the only one have this problem, me also had before. But we are lucky that we have friends in this forum who can share and help us. Douglas Poston gave me a clue which I can share to you :
1. Make a module that declare your variable is global variable such as :
Global strVar As String

2. below the declaration statement put a function :
Public Function getstring()
getstring = strVar
End Function

3. The interesting thing is we can put getstring() as a report object or in criteria query. And we can use again later.
4. But don’t forget we have to give a value to this variable we can take from a form.
Such as we can put in on unload event :
Private Sub Form_Unload(Cancel As Integer)
strVar = Me!strInput
End Sub
Good luck
By the way why the keyword search in Tek Tip still can not be used? . When will it work?
 
Hi ,

You are not the only one have this problem, me also had before. But we are lucky that we have friends in this forum who can share and help us. Douglas Poston gave me a clue which I can share to you :
1. Make a module that declare your variable is global variable such as :
Global strVar As String

2. below the declaration statement put a function :
Public Function getstring()
getstring = strVar
End Function

3. The interesting thing is we can put getstring() as a report object or in criteria query. And we can use again later.
4. But don’t forget we have to give a value to this variable we can take from a form.
Such as we can put in on unload event :
Private Sub Form_Unload(Cancel As Integer)
strVar = Me!strInput
End Sub
Good luck
By the way why the keyword search in Tek Tip still can not be used? . When will it work?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top