Finding Records

D

DS

I'm using this code on a listbox to find records on the same form. It
works fine except I need to base this on 2 criteria not one.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

I tried this but it didn't work.

Me.RecordsetClone.FindFirst "[LineId],[ItemID] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Any help Appreciated.
Thanks
DS
 
K

Klatuu

Me.RecordsetClone.FindFirst "[LineId] = '" & Me![List52] & "' And [ItemID] =
'" Me.SomeOtherControl & "'"
 
D

DS

Klatuu said:
Me.RecordsetClone.FindFirst "[LineId] = '" & Me![List52] & "' And [ItemID] =
'" Me.SomeOtherControl & "'"

:

I'm using this code on a listbox to find records on the same form. It
works fine except I need to base this on 2 criteria not one.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

I tried this but it didn't work.

Me.RecordsetClone.FindFirst "[LineId],[ItemID] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Any help Appreciated.
Thanks
DS
Thanks, I tried this....and nothing happened. They are both of the same
listbox, column(0) id LineID and Column(1) is ItemID.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & " And [ItemID]
= " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Thanks
DS
 
K

Klatuu

Then you have to address them by column number
Me.RecordsetClone.FindFirst "[LineId] = '" & Me![List52].Column(?) & "' And
[ItemID] = '" & Me![List52].Column(?) & "'"
Note I corrected a syntax error in my original reply.
Also, if either of the fields in your table is numeric, then remove the
single quotes. They are for text fields. If they are dates, replace the
single quotes with #

DS said:
Klatuu said:
Me.RecordsetClone.FindFirst "[LineId] = '" & Me![List52] & "' And [ItemID] =
'" Me.SomeOtherControl & "'"

:

I'm using this code on a listbox to find records on the same form. It
works fine except I need to base this on 2 criteria not one.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

I tried this but it didn't work.

Me.RecordsetClone.FindFirst "[LineId],[ItemID] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Any help Appreciated.
Thanks
DS
Thanks, I tried this....and nothing happened. They are both of the same
listbox, column(0) id LineID and Column(1) is ItemID.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & " And [ItemID]
= " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Thanks
DS
 
D

DS

Klatuu said:
Then you have to address them by column number
Me.RecordsetClone.FindFirst "[LineId] = '" & Me![List52].Column(?) & "' And
[ItemID] = '" & Me![List52].Column(?) & "'"
Note I corrected a syntax error in my original reply.
Also, if either of the fields in your table is numeric, then remove the
single quotes. They are for text fields. If they are dates, replace the
single quotes with #

:

Klatuu said:
Me.RecordsetClone.FindFirst "[LineId] = '" & Me![List52] & "' And [ItemID] =
'" Me.SomeOtherControl & "'"

:



I'm using this code on a listbox to find records on the same form. It
works fine except I need to base this on 2 criteria not one.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

I tried this but it didn't work.

Me.RecordsetClone.FindFirst "[LineId],[ItemID] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Any help Appreciated.
Thanks
DS

Thanks, I tried this....and nothing happened. They are both of the same
listbox, column(0) id LineID and Column(1) is ItemID.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & " And [ItemID]
= " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Thanks
DS
Thanks, still won't work, nothing happens. Yes the fields are numeric.
Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52].Column(0) & "
And [ItemID] = " & Me![List52].Column(1) & ""


Thanks
DS
 
K

Klatuu

You don't need the & "" on the end. That may not solve the problem, however.
Step through the code in debug mode and see if you are actually finding a
record.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52].Column(0) & " And
[ItemID] = " & Me![List52].Column(1)

DS said:
Klatuu said:
Then you have to address them by column number
Me.RecordsetClone.FindFirst "[LineId] = '" & Me![List52].Column(?) & "' And
[ItemID] = '" & Me![List52].Column(?) & "'"
Note I corrected a syntax error in my original reply.
Also, if either of the fields in your table is numeric, then remove the
single quotes. They are for text fields. If they are dates, replace the
single quotes with #

:

Klatuu wrote:

Me.RecordsetClone.FindFirst "[LineId] = '" & Me![List52] & "' And [ItemID] =
'" Me.SomeOtherControl & "'"

:



I'm using this code on a listbox to find records on the same form. It
works fine except I need to base this on 2 criteria not one.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

I tried this but it didn't work.

Me.RecordsetClone.FindFirst "[LineId],[ItemID] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Any help Appreciated.
Thanks
DS


Thanks, I tried this....and nothing happened. They are both of the same
listbox, column(0) id LineID and Column(1) is ItemID.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & " And [ItemID]
= " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Thanks
DS
Thanks, still won't work, nothing happens. Yes the fields are numeric.
Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52].Column(0) & "
And [ItemID] = " & Me![List52].Column(1) & ""


Thanks
DS
 
D

DS

DS said:
Klatuu said:
Then you have to address them by column number
Me.RecordsetClone.FindFirst "[LineId] = '" & Me![List52].Column(?) &
"' And [ItemID] = '" & Me![List52].Column(?) & "'"
Note I corrected a syntax error in my original reply.
Also, if either of the fields in your table is numeric, then remove
the single quotes. They are for text fields. If they are dates,
replace the single quotes with #

:

Klatuu wrote:

Me.RecordsetClone.FindFirst "[LineId] = '" & Me![List52] & "' And
[ItemID] = '" Me.SomeOtherControl & "'"

:



I'm using this code on a listbox to find records on the same form.
It works fine except I need to base this on 2 criteria not one.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

I tried this but it didn't work.

Me.RecordsetClone.FindFirst "[LineId],[ItemID] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Any help Appreciated.
Thanks
DS


Thanks, I tried this....and nothing happened. They are both of the
same listbox, column(0) id LineID and Column(1) is ItemID.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & " And
[ItemID] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Thanks
DS
Thanks, still won't work, nothing happens. Yes the fields are numeric.
Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52].Column(0) & "
And [ItemID] = " & Me![List52].Column(1) & ""


Thanks
DS
Got it to work! Thanks A Million. I forgot to take out the ' before
the last line. Time to rest.
Thanks
Sincerely
DS
 
K

Klatuu

Great! Glad I could help

DS said:
DS said:
Klatuu said:
Then you have to address them by column number
Me.RecordsetClone.FindFirst "[LineId] = '" & Me![List52].Column(?) &
"' And [ItemID] = '" & Me![List52].Column(?) & "'"
Note I corrected a syntax error in my original reply.
Also, if either of the fields in your table is numeric, then remove
the single quotes. They are for text fields. If they are dates,
replace the single quotes with #

:


Klatuu wrote:

Me.RecordsetClone.FindFirst "[LineId] = '" & Me![List52] & "' And
[ItemID] = '" Me.SomeOtherControl & "'"

:



I'm using this code on a listbox to find records on the same form.
It works fine except I need to base this on 2 criteria not one.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

I tried this but it didn't work.

Me.RecordsetClone.FindFirst "[LineId],[ItemID] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Any help Appreciated.
Thanks
DS


Thanks, I tried this....and nothing happened. They are both of the
same listbox, column(0) id LineID and Column(1) is ItemID.

Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52] & " And
[ItemID] = " & Me![List52] & ""
Me.Bookmark = Me.RecordsetClone.Bookmark

Thanks
DS
Thanks, still won't work, nothing happens. Yes the fields are numeric.
Me.RecordsetClone.FindFirst "[LineId] = " & Me![List52].Column(0) & "
And [ItemID] = " & Me![List52].Column(1) & ""


Thanks
DS
Got it to work! Thanks A Million. I forgot to take out the ' before
the last line. Time to rest.
Thanks
Sincerely
DS
 

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