I have been using VB6 to read data from Access. Now I want to write into the data base. I have set up a simple table with fields to test:
ID Name Number Mark
I have populated 5 records with random contents. In VB6 I have a form with one Command Button and one Text Box. The Text Box is bound to the Number field of the table. The following code is under the button:
Public Sub Command1_Click()
lnkData.CommandType = adCmdUnknown
lnkData.RecordSource = "UPDATE Test1 SET Test1.Number=123 WHERE ID=3"
lnkData.RecordSource = "SELECT Number FROM Test1 WHERE ID=3"
lnkData.Refresh
End Sub
The SELECT statement reads what is actually in the field but the UPDATE statement never changes it.
The routine was orginally Private. When I changed it to Public the Update worked the first time through. AArrrrrgh! It does not make sense.
Help!
ID Name Number Mark
I have populated 5 records with random contents. In VB6 I have a form with one Command Button and one Text Box. The Text Box is bound to the Number field of the table. The following code is under the button:
Public Sub Command1_Click()
lnkData.CommandType = adCmdUnknown
lnkData.RecordSource = "UPDATE Test1 SET Test1.Number=123 WHERE ID=3"
lnkData.RecordSource = "SELECT Number FROM Test1 WHERE ID=3"
lnkData.Refresh
End Sub
The SELECT statement reads what is actually in the field but the UPDATE statement never changes it.
The routine was orginally Private. When I changed it to Public the Update worked the first time through. AArrrrrgh! It does not make sense.
Help!