Robert Wardlow
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
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
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]
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]
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.
What do you mean by an ID field? Both fields are text fields.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> 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.
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.
ASKER
Perfect, thank you very much.
strLinkCriteria = "[Property Address 1]='" & Me![Property Address 1] & "' " And "[Owner of Property]= " & Me![Owner of Property]