Search for record that requires two search terms

A

anthony

I have a table where the records are uniquely identified by a
combination of two fields ChildAOLTermID and PhotoID. I want to use a
combo on a form to look up records in the table. In the AfterUpdate
event:

DoCmd.SearchForRecord , , acFirst, "[ChildAOLTermID] = " &
Me.cboFindRecord.Column(0)

works but doesn't get me to the precise record I need because the
PhotoID side of the record is not being specified. However, if I add
that so that the search looks like:

DoCmd.SearchForRecord , , acFirst, "[ChildAOLTermID] = " &
Me.cboFindRecord.Column(0) And "[PhotoID] = " &
Me.cboFindRecord.Column(1)

then I get type mismatch. Now, either of those two criteria will work
on their own but not when put together so it's their combination that
gives the error not any problem with the data type

How do I smoke this one?

Many thanks
 
R

ruralguy via AccessMonster.com

The AND needs to be INSIDE of the string!
DoCmd.SearchForRecord , , acFirst, "[ChildAOLTermID] = " &
Me.cboFindRecord.Column(0) & " And [PhotoID] = " &
Me.cboFindRecord.Column(1)

I have a table where the records are uniquely identified by a
combination of two fields ChildAOLTermID and PhotoID. I want to use a
combo on a form to look up records in the table. In the AfterUpdate
event:

DoCmd.SearchForRecord , , acFirst, "[ChildAOLTermID] = " &
Me.cboFindRecord.Column(0)

works but doesn't get me to the precise record I need because the
PhotoID side of the record is not being specified. However, if I add
that so that the search looks like:

DoCmd.SearchForRecord , , acFirst, "[ChildAOLTermID] = " &
Me.cboFindRecord.Column(0) And "[PhotoID] = " &
Me.cboFindRecord.Column(1)

then I get type mismatch. Now, either of those two criteria will work
on their own but not when put together so it's their combination that
gives the error not any problem with the data type

How do I smoke this one?

Many thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top