defective number variable in an SQL statment. (1 Viewer)

LOUISBUHAGIAR54

Registered User.
Local time
Today, 12:09
Joined
Mar 14, 2010
Messages
157
Hi All Access programmers,

I have been trying to solve this problem with no success after a search on online sites.

I have an SQL statement with two variables, that does not seem to get going. I know that one variable is punctuated well and is working but the other seems to stick for some reason. Here is the statement;

strSQL = " UPDATE TblProducts SET TblProducts.Costprice = ' & danilprezz WHERE (((TblProducts.CPSUStockCode)= '" & codici & "'));"

danilprezz is a number variable introduced as Dim danilprezz as Currency, while codici is a string variable and functions well since the following statement works as expected;

strSQL = " UPDATE TblProducts SET TblProducts.Costprice = 7.13 WHERE (((TblProducts.CPSUStockCode)= '" & codici & "'));"

There must be something wrong with the punctuation of danilprezz.

Can anyone give me a hint to solve this problem please ?
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 05:09
Joined
Jan 20, 2009
Messages
12,852
Code:
strSQL = " UPDATE TblProducts SET TblProducts.Costprice = " & danilprezz & " WHERE (((TblProducts.CPSUStockCode)= '" & codici & "'));"
 

LOUISBUHAGIAR54

Registered User.
Local time
Today, 12:09
Joined
Mar 14, 2010
Messages
157
sPOT ON. Many thanks for your immediate help. I do not know how my searches on the internet prompted me to write in that variable as I have written it in the defective SQL statment.

Now it is working well. Cannot thank you enough.
 

Users who are viewing this thread

Top Bottom