Click here to Skip to main content
15,789,698 members
Please Sign up or sign in to vote.
1.18/5 (3 votes)
See more:
HI all,

Can someone please assist me on below.

I want to update the records in microsoft access using VB6. It works fine with below code. But I want to take the column name from user (textbox6) instead of fixed parameter.

What should be the code

Set mySet = mydb.OpenRecordset("Sheet1", dbOpenDynaset)
mySet![Vertical] = data1.Text
Updated 6-May-15 2:30am
CHill60 6-May-15 7:54am    
I think you can use mySet.Items(textbox6.Text) = data1.Text - you'll have to try it as I no longer have a copy of VB6
Gaus Shaikh 6-May-15 8:11am    
But it is not working. textbox6.text is considering as column name and textbox6 value is not taken
Gaus Shaikh 6-May-15 8:14am    
Getting error - Method or data member not found
CHill60 6-May-15 8:23am    
On the .Items? You might need to define which row first - again sorry, VB6 is so outdated I can't try this for you.
You could get the ordinal of the column using the technique on tek-tips[^] and use that to access the item
Gaus Shaikh 6-May-15 10:32am    
Thanks Sir. I got the solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900