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!

Change query paramaters based on different forms 1

Status
Not open for further replies.

eowyn12

IS-IT--Management
Sep 23, 2002
10
US
I have an append query that uses a variable on a form as a criteria.
The criteria of the query is something like this.

WHERE ((tblLoanTrans.ControlNo)=[forms]![frmLoanRO]![ControlNo])

I have another form frmLoanDD, with similar but slightly different controls.
I want to use the same append query using a criteria based on the textbox on frmLoanDD.

WHERE ((tblLoanTrans.ControlNo)=[forms]![frmLoanDD![ControlNo])

Is there any way to do this without making another append query with this criteria?
I tried to use a public variable, but couldn’t figure out how to put the public variable in a query.

Any suggestions would be greatly appreciated!

Yoko
 
Hi!

In a public variable approach, you'll need a public function to retrieve the variable value.

In a module (not a forms module):

[tt]Public Function GetMyPublic() as <Datatype of the return value>
GetMyPublic = MyPublicVariable
End Function[/tt]

Substitute the <..> text with the return value data type...

In the criteria row of your query enter the function:

[tt]GetMyPublic()[/tt]

HTH Roy-Vidar
 
It worked! Thank you very much, Roy!
This was my first time asking a question on Tek-Tips, and got the right answer in less than an hour...happily surprised!
Thank you again!
Yoko
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top