I have an unbound combo box [cboState] on a form, a sub-form running off a query [qryHeavyMaintenanceRegister] (I'm using a query for the sub-form as I have calculations running in the query which I want to display in the sub-form). On the AfterUpdate event I want the sub-form to show only the data for the State selected in the combo box.
I'm sure the issue is looking me right in the face but I'm not seeing it.
I'm getting a Run-time error that my select statement is missing or the punctuation is incorrect. I can't figure out what it is though, I've had this code working before and it's exactly the same.
Private Sub cboState_AfterUpdate()
Dim myState As String
myState = "Select from qryHeavymaintenanceregister where ((state) = " & Me.cboState & ")"
Me.sfrmHeavyMaintenanceRegister.Form.RecordSource = myState
Me.sfrmHeavyMaintenanceRegister.Form.Requery
End Sub