I have a form frmInstruments that lists a number of different instruments in the table tblInstruments. Located on frmInstruments is a command button btnAddEditMaintenanceHistory that when clicked I would like it to open frmInstrumentServiceRecords only for the the instrument currently displayed in frmInstruments. Seemed easy enough but after two days I am stumped. Below is the code for the click event for btnAddEditMaintenanceHistory.
Private Sub btnAddEditMaintenanceHistory_Click()
Dim vInstrumentServiced As String
Dim vSQL As String
vInstrumentServiced = Me.InstModel
vSQL = "[ServInstModel] = " & vInstrumentServiced
DoCmd.OpenForm "frmInstrumentServiceRecords", , , vSQL
End Sub
Me.InstModel is the Instrument field name on frmInstruments. ServInstModel is the field name on frmInstrumentServiceRecords that needs to be = to Me.InstModel.
When I run this I get a runtime error 3075 "Syntax error (missing operator) in query expression 'ServInstModel = Ampico B Mason & Hamlin 5'8" Grand.
Any thoughts?