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

Where Condition in Embedded Macro

Status
Not open for further replies.

iuianj07

Programmer
Sep 25, 2009
293
US
Hello Guys!

I have a form (form1) that I need to put a button that opens another form (form2) Form1 and Form2 have LoanNumber and TestPeriod fields, and I want that when I click the button to open Form2, it will only show records if the LoanNumber and TestPeriod in Form2 matches Form1.

I used an Embedded Macro for the button, then OpenForm.

In the Where Condition field, I wrote ="[LoanNumber]=" & [LoanNumber] for it to show records to match LoanNumbers.

My question would be is it needs to have 2 conditions, that it should have LoanNumber and TestPeriod equal to Form1.

Thank you, any help is greatly appreciated.
 
Something like this ?
="[LoanNumber]=" & [LoanNumber] & " AND [TestPeriod]=" & [TestPeriod]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hello PHV

I tried the code you gave me, and it had an error see below:

Syntax error(missing operator) in query expression '[LoanNumber]=502855937 AND [TestPeriod]=2010Q1'.

Do you happen to know what the missing operator is?

Thanks!
 
Code:
="[LoanNumber]=" & [LoanNumber] & " AND [TestPeriod]=[!]'[/!]" & [TestPeriod] [!]& "'"[/!]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hello PHV,

Thanks again for helping me out re-writing the Where Condition.

Could you spare a moment of your time and explain to me the above mentioned where clause? especially with all those missing operators and " ' & symbols.

Thank you and I appreciate it ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top