Danielle17
Technical User
I have created a form that contains a combo box that pulls up certain records. I'd like it so that the user could edit the information and then click the command button and the info would be changed in the table. I have it working so that if the info is changed on the form it will also change in the table. I also have two subforms that I would like to be able to edit. I couldn't figure out how to build the event for that...I'm not extremely good at coding. The problem with the code I have now is that when I do make a change on the form and then click the command button the change will take place but then when I go to check the changes in the table I noticed that it changes the record it's supposed to but it also changes the first record in the the table. I'm not sure why it's doing this. Here's the code for the command button...Any help would be appreciated
Private Sub cmdEditJob_Click()
Dim db As Database
Dim tdEdit As TableDef
Dim rsEdit As Recordset
Dim fmEdit As Form_Editing
Set db = CurrentDb
Set tdEdit = db.TableDefs("zJobTable"
Set rsEdit = tdEdit.OpenRecordset()
rsEdit.edit
rsEdit.Fields("Customer"
= txtCustomer
rsEdit.Fields("Phone #"
= txtPhNum
rsEdit.Fields("Contact"
= txtContact
rsEdit.Fields("PO#"
= txtPO
rsEdit.Fields("Start Date"
= txtStDt
rsEdit.Fields("End Date"
= txtEnDt
rsEdit.Fields("Notes"
= txtNotes
rsEdit.Fields("Description"
= txtDescr
rsEdit.Update
End Sub
p.s. I don't have the code for the subforms on there yet. I'm not exactly sure how to do it. Any suggestions?
Private Sub cmdEditJob_Click()
Dim db As Database
Dim tdEdit As TableDef
Dim rsEdit As Recordset
Dim fmEdit As Form_Editing
Set db = CurrentDb
Set tdEdit = db.TableDefs("zJobTable"
Set rsEdit = tdEdit.OpenRecordset()
rsEdit.edit
rsEdit.Fields("Customer"
rsEdit.Fields("Phone #"
rsEdit.Fields("Contact"
rsEdit.Fields("PO#"
rsEdit.Fields("Start Date"
rsEdit.Fields("End Date"
rsEdit.Fields("Notes"
rsEdit.Fields("Description"
rsEdit.Update
End Sub
p.s. I don't have the code for the subforms on there yet. I'm not exactly sure how to do it. Any suggestions?