Findfirst failing with a variable drawn from an autonumber field.
That about says it; I grab a variable from the key field (an autonumber) and then turn it into a string ( Ive tried all the ways possible I think ) to find it against a text field.
So, in the code I do
vcard_fkey = Me!ID
and then I try
rs.FindFirst "fkey=" & vcard_fkey & "and type = 'card'"
and it blows up with a “data type mismatch in criteria expression”
I then try casting the variable into a string(no good), and then I declared it as a string(no good) and then I checked it was a string with
MsgBox TypeName(vcard_fkey)
And , indeed it was a string, and yes, fkey is a text field
And it all worked the other way, when fkey was a number field, but I needed it as a text
so let me add:
Help !
That about says it; I grab a variable from the key field (an autonumber) and then turn it into a string ( Ive tried all the ways possible I think ) to find it against a text field.
So, in the code I do
vcard_fkey = Me!ID
and then I try
rs.FindFirst "fkey=" & vcard_fkey & "and type = 'card'"
and it blows up with a “data type mismatch in criteria expression”
I then try casting the variable into a string(no good), and then I declared it as a string(no good) and then I checked it was a string with
MsgBox TypeName(vcard_fkey)
And , indeed it was a string, and yes, fkey is a text field
And it all worked the other way, when fkey was a number field, but I needed it as a text
so let me add:
Help !