Hi,
I got 2 forms named TruckMaintenance_Main and TruckMaintenance_sub. On my Sub form i have a delete button to delete a row and this code below works if I click the delete button on TruckMaintenance_sub. But when i put TruckMaintenance_Sub as sub form of TruckMaintenance_main, the delete button won't work. Can anyone help me why this code won't work?
I got 2 forms named TruckMaintenance_Main and TruckMaintenance_sub. On my Sub form i have a delete button to delete a row and this code below works if I click the delete button on TruckMaintenance_sub. But when i put TruckMaintenance_Sub as sub form of TruckMaintenance_main, the delete button won't work. Can anyone help me why this code won't work?
Private Sub btnDelete_Click()
Dim SQL As String
SQL = "DELETE tbl_TruckMaintenance.TruckRego, tbl_TruckMaintenance.TrailerRego, tbl_TruckMaintenance.DriverName" _
& " FROM tbl_TruckMaintenance" _
& " WHERE (((tbl_TruckMaintenance.TruckRego)=[Forms]![Truck Maintenance_sub]![txtTruck]));"
DoCmd.RunSQL SQL
Me.Requery
End Sub