Pauline123
Registered User.
- Local time
- Today, 12:55
- Joined
- Apr 1, 2013
- Messages
- 69
Hi, hope someone can help.
I have a main form with a tab control.
In the tab control I have a subform.
I wish to update the data in the subform with values entered into unbound text boxes in the tab control on the main form.
Main Form Name: VehicleDetailsFormUPDATE - Primary Key: VehicleID
Tab Control Name: TabCtl152
Unbound Text Box Names: TxttxtCLStartDate / txtDriver / txtMileageTD
Subform Name:VehicleChecklistSubTB subform (source:VehicleChecklistSubTB)
Subform Fields: VehicleID, CLStartDate, Driver, MileageTD.
I have a command button on the tab control with the following code in the On Click Event:
Private Sub Command161_Click()
Dim db As Database
Dim rec As Recordset
Set db = CurrentDb
Set rec = db.OpenRecordset("Select * from VehicleChecklistSubTB")
rec.AddNew
rec("CLStartDate") = Me.txtCLStartDate
rec("Driver") = Me.txtDriver
rec("MileageTD") = Me.txtMileageTD
rec.Update
Set rec = Nothing
Set db = Nothing
End Sub
This code just does not work - I believe its because I have not referenced the subform in the coding but so far I have not figured it out. Can someone help - feeling frazzled Pauline
I have a main form with a tab control.
In the tab control I have a subform.
I wish to update the data in the subform with values entered into unbound text boxes in the tab control on the main form.
Main Form Name: VehicleDetailsFormUPDATE - Primary Key: VehicleID
Tab Control Name: TabCtl152
Unbound Text Box Names: TxttxtCLStartDate / txtDriver / txtMileageTD
Subform Name:VehicleChecklistSubTB subform (source:VehicleChecklistSubTB)
Subform Fields: VehicleID, CLStartDate, Driver, MileageTD.
I have a command button on the tab control with the following code in the On Click Event:
Private Sub Command161_Click()
Dim db As Database
Dim rec As Recordset
Set db = CurrentDb
Set rec = db.OpenRecordset("Select * from VehicleChecklistSubTB")
rec.AddNew
rec("CLStartDate") = Me.txtCLStartDate
rec("Driver") = Me.txtDriver
rec("MileageTD") = Me.txtMileageTD
rec.Update
Set rec = Nothing
Set db = Nothing
End Sub
This code just does not work - I believe its because I have not referenced the subform in the coding but so far I have not figured it out. Can someone help - feeling frazzled Pauline