Link to home
Start Free TrialLog in
Avatar of Robert Wardlow
Robert WardlowFlag for United States of America

asked on

Access VBA syntax for report

Thank you in advance for your help.
I am having so much trouble figuring out the syntax for different combinations of criteria

I am trying to print a report and limit the results to the value of 2 text fields

Below is the syntax I created but it is producing a type mismatch.


strLinkCriteria = "[Property Address 1]='" & Me![Property Address 1] & "' " And "[Owner of Property]= '" & Me![Owner of Property] & "'"

What am I doing wrong?

Thank you for your help
Bob


Avatar of mbizup
mbizup
Flag of Kazakhstan image

If you are storing propery owner by an ID field, try this instead:

strLinkCriteria = "[Property Address 1]='" & Me![Property Address 1] & "' " And "[Owner of Property]= " & Me![Owner of Property]
You also have mis matched quotes.

Try this:

strLinkCriteria = "[Property Address 1]='" & Me![Property Address 1] & "'  And [Owner of Property]= '" & Me![Owner of Property] & "'"

Or this if propery owner is stored as a numeric ID:

strLinkCriteria = "[Property Address 1]='" & Me![Property Address 1] & "'  And [Owner of Property]= " & Me![Owner of Property]


Avatar of Robert Wardlow

ASKER

Thanks for your suggestion. But that still gave a type mismatch error.

What do you mean by an ID field?  Both fields are text fields.
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> What do you mean by an ID field?

That generally means that you have an employees table with a numeric Primary key (automumber) associated with each emplyee, and that you are storing that numeric field as a 'foreign key' in other tables in your database instead of the actual text name.
Perfect, thank you very much.