AvesRule33
Technical User
I have a form called frmWorkOrderEntry which has a number of text boxes to allow the information to be entered.
[UnitNo] (Combo box list of equipment)
Row Source = SELECT [SiouxCityCampusEquipment].[UnitNo], [SiouxCityCampusEquipment].[EquipType], [SiouxCityCampusEquipment].[Type], [SiouxCityCampusEquipment].[Make], [SiouxCityCampusEquipment].[ModelNo], [SiouxCityCampusEquipment].[SerialNo], [SiouxCityCampusEquipment].[Location] FROM SiouxCityCampusEquipment WHERE ((([SiouxCityCampusEquipment].[EquipType])="Truck")) ORDER BY [SiouxCityCampusEquipment].[UnitNo];
[EquipType] (Populated from UnitNo combo - control source =[UnitNo].column(1))
[Type](Populated from UnitNo combo - control source =[UnitNo].column(2))
And 5 other unbound fields that are populated from the UnitNo combo. User is then required to manually fill in
4 other unbound fields such as [WorkOrderNo], [ServiceDate], etc....
Once the user has selected the UnitNo from the combo list, the other unbound fields are populated, so that works fine.
The probem I am having is that once this information has been filled in, I want to use an AddRecord button to append the forms information into the REPAIRS table. So far I have not been able to make that happen?
Here is my Event Procedure that is located in the OnClick property of the AddRecord button that is giving me fits:
Private Sub cmdAddRecord_Click()
Dim strSQL As String
Dim db As Database
Set db = CurrentDb
strSQL = "INSERT INTO [Repairs] "
strSQL = [UnitNo] = Me.[UnitNo].Value
strSQL = [EquipType] = Me.[EquipType].Value
strSQL = [Type] = Me.[Type].Value
strSQL = [Make] = Me.[Make].Value
strSQL = [ModelNo] = Me.[ModelNo].Value
strSQL = [SerialNo] = Me.[SerialNo].Value
strSQL = [Location] = Me.[Location].Value
strSQL = [ServiceDate] = Me.[ServiceDate].Value
strSQL = [WorkOrderNo] = Me.[WorkOrderNo].Value
strSQL = [Hours] = Me.[Hours].Value
strSQL = [Description] = Me.[Description].Value
db.Execute strSQL
End Sub
The SerialNo field is the Primary Key in the SiouxCityCampusEquipment table. I do not have a Primary Key set in the Repairs table that I am trying to append the record to.
I also need to know how to clear the form afterupdate so that the user can select another UnitNo from the combo box and add another Work Order.
I hope I have provided enough information and have not confused the issue to much!! Any help would be "GREATLY APPRECIATED" as I have been batteling with this for days and the boss is breathing down my neck to get this database working
[UnitNo] (Combo box list of equipment)
Row Source = SELECT [SiouxCityCampusEquipment].[UnitNo], [SiouxCityCampusEquipment].[EquipType], [SiouxCityCampusEquipment].[Type], [SiouxCityCampusEquipment].[Make], [SiouxCityCampusEquipment].[ModelNo], [SiouxCityCampusEquipment].[SerialNo], [SiouxCityCampusEquipment].[Location] FROM SiouxCityCampusEquipment WHERE ((([SiouxCityCampusEquipment].[EquipType])="Truck")) ORDER BY [SiouxCityCampusEquipment].[UnitNo];
[EquipType] (Populated from UnitNo combo - control source =[UnitNo].column(1))
[Type](Populated from UnitNo combo - control source =[UnitNo].column(2))
And 5 other unbound fields that are populated from the UnitNo combo. User is then required to manually fill in
4 other unbound fields such as [WorkOrderNo], [ServiceDate], etc....
Once the user has selected the UnitNo from the combo list, the other unbound fields are populated, so that works fine.
The probem I am having is that once this information has been filled in, I want to use an AddRecord button to append the forms information into the REPAIRS table. So far I have not been able to make that happen?
Here is my Event Procedure that is located in the OnClick property of the AddRecord button that is giving me fits:
Private Sub cmdAddRecord_Click()
Dim strSQL As String
Dim db As Database
Set db = CurrentDb
strSQL = "INSERT INTO [Repairs] "
strSQL = [UnitNo] = Me.[UnitNo].Value
strSQL = [EquipType] = Me.[EquipType].Value
strSQL = [Type] = Me.[Type].Value
strSQL = [Make] = Me.[Make].Value
strSQL = [ModelNo] = Me.[ModelNo].Value
strSQL = [SerialNo] = Me.[SerialNo].Value
strSQL = [Location] = Me.[Location].Value
strSQL = [ServiceDate] = Me.[ServiceDate].Value
strSQL = [WorkOrderNo] = Me.[WorkOrderNo].Value
strSQL = [Hours] = Me.[Hours].Value
strSQL = [Description] = Me.[Description].Value
db.Execute strSQL
End Sub
The SerialNo field is the Primary Key in the SiouxCityCampusEquipment table. I do not have a Primary Key set in the Repairs table that I am trying to append the record to.
I also need to know how to clear the form afterupdate so that the user can select another UnitNo from the combo box and add another Work Order.
I hope I have provided enough information and have not confused the issue to much!! Any help would be "GREATLY APPRECIATED" as I have been batteling with this for days and the boss is breathing down my neck to get this database working