I am just testing a 2 field form to see how to update a field in Access from VB. I know this is basic but I am new at this. It is going to the right row and getting the right jobnumber from the access database. I did that so I could see if it was connecting to the database. But when I change the Text box to reflect the new number I want in its place in the database it doesn't complete the action. The end result is I want to capture the fields that I have on my form and get them into an access database.
Here is my code.
Private cn As ADODB.Connection
Private mrscust As ADODB.Recordset
Private Sub Form_Load()
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\testcount\countsplt42.mdb;Persist Security Info=False"
Set mrscust = New ADODB.Recordset
mrscust.LockType = adLockBatchOptimistic
mrscust.CursorLocation = adUseClient
mrscust.CursorType = adOpenKeyset
Private Sub Command1_Click()
Dim strSQL As String
strSQL = "Select * from 22shop_5min where [22shop_5min].id = 2"
mrscust.Source = strSQL
Set mrscust.ActiveConnection = cn
Label1.Caption = mrscust.Fields("jobnumber")
mrscust.Fields("jobnumber") = Text1.Text
Thanks for your help in advance!