• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

SQL command to update in VB6

GShaikh

Junior Member
Hi all,

I am using VB6 and DAO connnection with Access.

I want to update the records in access using VB. The column name and comments to be updated will be provided by user in text box. Please provide me the SQL command for the same.

I tried below but not working

"UPDATE Sheet1 SET '"&text6.text&"'='"&text47.Text&"'Where Vertical = '" & Combo1.text & "'"
 
This looks like homework. We'll help, but we won't solve it for you.

I suggest you take that concatenated mess, add a statement to show the result of the concatenations (e.g. print or msgbox), and see if anything looks wrong.

If you don't see anything, I see a couple of things:

1.
Spacing
.
2.
Don't quote column names
.
 
Looks like your "SET FIELD" is surrounded by single quotes. Field names should not be surrounded by '... if they have spaces, surround them with [ and ].

EX:

Code:
"UPDATE Sheet1 SET ["&text6.text&"]='"&text47.Text&"'Where Vertical = '" & Combo1.text & "'"

Only use ' when you are matching or setting a text field value in the table.
 
Back
Top