fishfishburn
New member
- Local time
- Today, 09:36
- Joined
- Jun 13, 2012
- Messages
- 2
Hi All,
Struggling a bit with a 'Where' condition on a 'SearchForRecord' macro that I'm trying to build in Access 2010.
I have a column in a query called 'Company' and another called 'Model Code'. I have two corresponding combo boxes on a form called 'CompanyCB' and 'ModelCode'.
I am trying to return the first record where both the 'Company' and 'Model Code' columns in the query match the contents of the 'CompanyCB' and 'ModelCode' combo boxes.
I have code for matching one at a time which works for both.
Model Code
Company
The problem comes when I try and combine them with 'AND'. My code is as follows:
However this doesn't return a result. I'm guessing that I'm not joining the two conditions correctly as they both work on their own.
Any steer gratefully received.
Thanks
Richard
Struggling a bit with a 'Where' condition on a 'SearchForRecord' macro that I'm trying to build in Access 2010.
I have a column in a query called 'Company' and another called 'Model Code'. I have two corresponding combo boxes on a form called 'CompanyCB' and 'ModelCode'.
I am trying to return the first record where both the 'Company' and 'Model Code' columns in the query match the contents of the 'CompanyCB' and 'ModelCode' combo boxes.
I have code for matching one at a time which works for both.
Model Code
Code:
="[Model Code] = " & "'" & [Forms]![Account and Model Costs Query]![ModelCode] & "'"
Company
Code:
="[Company] = " & "'" & [Forms]![Account and Model Costs Query]![CompanyCB] & "'"
The problem comes when I try and combine them with 'AND'. My code is as follows:
Code:
="[Model Code] = " & "'" & [Forms]![Account and Model Costs Query]![ModelCode] & "'" AND "[Company] = " & "'" & [Forms]![Account and Model Costs Query]![CompanyCB] & "'"
However this doesn't return a result. I'm guessing that I'm not joining the two conditions correctly as they both work on their own.
Any steer gratefully received.
Thanks
Richard