Edit data on table with VBA

strQuery = "Update Beställda-Produkter Set Enhetspris = '1' Where Produktnummer = '7240';"

that's the message I get when I hold the arrow above the yellow field.
 
Then try this code

Code:
"Update Beställda-Produkter" & _
"Set Enhetspris = "  & Text45.Value  & _
" Where Produktnummer = " & Text51.Value & ";"
debug.print strQuery
CurrentDb.Execute strQuery
 
this have changed color to red and a syntax error appearing:

"Update Beställda-Produkter" & _
"Set Enhetspris = & Text45.Value " & _
"Where Produktnummer = " & Text51.Value & ";"

Is this SQL code?
regards
xxd
 
XXD,

Code:
"Update [B][[/B]Beställda-Produkter[B]] [/B]" & _
"Set Enhetspris = & Text45.Value [B]& " " & _[/B]
"Where Produktnummer = " & Text51.Value & ";"

This assumes that Produktnummer is the name of the field in the table.
You did change it right.

Also, I put [Beställda-Produkter] in brackets because it looks like you
are subtracting Produkter from bestallda. And I added a space after the table
name.

Wayne
 
Hi
Thanks for all help it's working great. The problem was that the table needed to be inside []
Thanks again
xxd
 
Hi
Thanks for all help it's working great. The problem was that the table needed to be inside []
Thanks again
xxd
Glad you have got it working. Lycka Till!
 

Users who are viewing this thread

Back
Top Bottom