sjmmajor
asked on
updating more than 1 field using sql statement
Here is the code I am now using. How would I rewrite this to update more than 1 field without writing multiple Update statements? I have around 30 fields to actually update in my Access Database.
Syntax
UPDATE [DatabaseName1!]TableName1
SET Column_Name1 = eExpression1
[, Column_Name2 = eExpression2 ...]
WHERE FilterCondition1 [AND | OR FilterCondition2 ...]]
Good Luck.
UPDATE [DatabaseName1!]TableName1
SET Column_Name1 = eExpression1
[, Column_Name2 = eExpression2 ...]
WHERE FilterCondition1 [AND | OR FilterCondition2 ...]]
Good Luck.
I think you have forgotton to post your code, anyways hongjun and yongyih are correct for the update statement. How were you doing the same then??
-priya
-priya
ASKER
I tried the above and it gives me a parameter error. Here is my code.
sSql1 = "UPDATE 22shop_5min SET jobnumber= " & JobNumber22 & " where [22shop_5min].id = 1"
If I had fields
text1
text2
text3
how would I go about using those fields in one statement?
sSql1 = "UPDATE 22shop_5min SET jobnumber= " & JobNumber22 & " where [22shop_5min].id = 1"
If I had fields
text1
text2
text3
how would I go about using those fields in one statement?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks so much. It was syntax that was getting me. I knew it had to be easy. I just couldn't see it.
Great!!
Great!!
you're welcome!
-priya
-priya
update table_name
set field1 = field1_value,
field2 = field2_value
where id = 1
hongjun