Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access 97 using variant data types from recordsets
Message
From
28/04/1998 07:04:57
 
 
To
27/04/1998 23:43:23
General information
Forum:
Microsoft Office
Category:
Access
Miscellaneous
Thread ID:
00095296
Message ID:
00095336
Views:
34
Hi Ryan.
Forgive me for bad English but I will try to explain.

>I am trying to update a table using a value from a recordset using an update query as follows
>
>DoCmd.RunSQL "UPDATE BookKeywords " & _
> "SET BookKeywords.KeywordID = '" & rst.Fields(0) & "'" & _
> "WHERE BookKeywords.KeywordID = '" & Oldkeyword & "';"
>
>The value in rst.Fields(0) looks like the correct key value (40) when I put a watch on it, but the type of this field in the watch is variant/integer. I get a data type mismatch when this sql is performed. I've tried to convert the value using the CInt function but it still shows up as variant/integer in the watch window.
>
>Please help me!!!
>Ryan

As I has understood type of Field "KeywordID" - Integer.
Why you're using quotation marks in:
...BookKeywords.KeywordID = '" & rst.Fields(0) & "'" & ...
in result SQL command looks as:
"...BookKeywords.KeywordID = '40'..."
and as result you see "data type mismatch" message. '40' - a string type.

Try without quotes:
DoCmd.RunSQL "UPDATE BookKeywords " & _
"SET BookKeywords.KeywordID = " & rst.Fields(0) & _
" WHERE BookKeywords.KeywordID = " & Oldkeyword & ";"

Best regards.

Alexander Grigorjev
Alex
Previous
Reply
Map
View

Click here to load this message in the networking platform