adodb rst find

H

Heather Vernon

I keep getting an error ("Arguments are of the wrong type, are out of
acceptable range, or are in conflict with one another") with my
rstAnimals.find command if my string strTagID starts with a letter. But I
don't get an error if strTagID starts with a number (regardless of whether
there are other letters in the string). If I nest my string in quotes, like
would make sense, I don't get an error BUT I can't find my strTagID in my
recordset if it starts with a number (I'm not sure if it finds the record if
strTagID starts with a letter). Hopefully one of you can see an obvious
solution that I can't. I'd rather not check if the first character is
numeric, and then execute a different find command for each case (if it even
works when the string starts w/ a letter).

rstAnimals.Open "SELECT Right([tblAnimalInfo]![TagId],4) As Ref, " & _
" tblCollection.CollectionId" & _
" FROM tblCollection INNER JOIN (tblAnimalInfo INNER JOIN
tblSelections ON" & _
" tblAnimalInfo.AnimalId = tblSelections.AnimalId) ON" & _
" tblAnimalInfo.AnimalId = tblCollection.AnimalID" & _
" WHERE " & strIDs, _
CurrentProject.Connection, adOpenStatic, adLockReadOnly
 
H

Heather Vernon

Here's the rest of my code; seems to have been lost...

rstAnimals.MoveFirst
rstAnimals.Find "[Ref] = " & strTagID & ""
 
D

Douglas J Steele

If Ref is a text field, you need quotes around the value:

rstAnimals.Find "[Ref] = " & Chr$(34) & strTagID & Chr$(34)

or

rstAnimals.Find "[Ref] = '" & strTagID & "'"

(exagerated for clarity, that second one is rstAnimals.Find "[Ref] = ' " &
strTagID & " ' ")
 

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