Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Access 97 using variant data types from recordsets
Message
De
28/04/1998 07:04:57
 
 
À
27/04/1998 23:43:23
Information générale
Forum:
Microsoft Office
Catégorie:
Access
Divers
Thread ID:
00095296
Message ID:
00095336
Vues:
35
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform