SQL Update not working (1 Viewer)

exaccess

Registered User.
Local time
Today, 01:56
Joined
Apr 21, 2013
Messages
287
Code:
DoCmd.RunSQL "UPDATE [" & dest & "] SET [Association] '=' [" & Associate & "];"
This SQL statement causes trouble. I tried many variations but none worked. Here the dest is a variable containing the tablename, Association is the name of a column of dest and Associate is a variable containing the data to be stored in all table records. Please help.
 

JHB

Have been here a while
Local time
Today, 01:56
Joined
Jun 17, 2012
Messages
7,732
Code:
DoCmd.RunSQL "UPDATE [" & dest & "] SET [Association] '=' [" & Associate & "];"
This SQL statement causes trouble.
If Association is text then:
"UPDATE [" & dest & "] SET [Association] ='" & Associate & "'"
If number then:
"UPDATE [" & dest & "] SET [Association] =" & Associate & "
 

exaccess

Registered User.
Local time
Today, 01:56
Joined
Apr 21, 2013
Messages
287
If Association is text then:
"UPDATE [" & dest & "] SET [Association] ='" & Associate & "'"
If number then:
"UPDATE [" & dest & "] SET [Association] =" & Associate & "

Works like charm, thank you
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:56
Joined
Feb 28, 2001
Messages
27,138
You DO realize that your UPDATE updated EVERY RECORD in the destination? You have no WHERE clause so it is an unconstrained update.

If that is what you wanted, or if you simplified it for discussion, then no problem.
 

exaccess

Registered User.
Local time
Today, 01:56
Joined
Apr 21, 2013
Messages
287
Yes that is what I wanted. This table is not normalized. It is an old aplication.
 

Users who are viewing this thread

Top Bottom