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 bkrike 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 an 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, ReportingPeriod and PropertyNumber fields, and I want that when I click the button to open Form2, it will only show records if the LoanNumber, ReportingPeriod and PropertyNumber in Form2 matches Form1.

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

In the Where Condition field, I wrote

Code:
="[LoanNumber]=" & [LoanNumber] & " AND [ReportingPeriod]='" & [ReportingPeriod] & "'"

My question would be is it needs to have 3 conditions, that it should have LoanNumber, ReportingPeriod and PropertyNumber equal to Form1.

I tried to write this code:

Code:
="[LoanNumber]=" & [LoanNumber] & " AND [ReportingPeriod]=" & [ReportingPeriod] & " AND [PropertyNumber]='" & [PropertyNumber] & "'"

But it says that it has syntax error (missing operator) in query expression.

I guess there is just some missing operator from this query, hopefully you could help me out.

And if possible, can you also explain the whole syntax? With what the " ' and & are for, I kinda undestand vaguely and hopefully somebody would have the patience in explaining it clearly.

Thank you.


Thank you, any help is greatly appreciated.
 
Code:
="[LoanNumber]=" & [LoanNumber] & " AND [ReportingPeriod]=[!]'[/!]" & [ReportingPeriod] & "[!]'[/!] AND [PropertyNumber]='" & [PropertyNumber] & "'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top