Hi
I have placed a command button on a form to duplicate a record in an effort reduce typing. When I click on the duplicate button, Access return a Run-time error 3075 and open the Visual Basic editor and highlighting this line of code.
Set qdef = CurrentDb.CreateQueryDef(sQueryName, "Select * from TripBook where route = " & Me.cboRoute)
Here is the complete code. This code is not related to the command button. This is a combo box. Why is the error pointing to this line? The combo box works fine.
Private Sub cboRoute_AfterUpdate()
Dim qdef As querydef
Dim sQueryName As String
sQueryName = "qryRt_1"
Me.RecordSource = ""
DoCmd.DeleteObject A_QUERY, sQueryName
Set qdef = CurrentDb.CreateQueryDef(sQueryName, "Select * from TripBook where route = " & Me.cboRoute)
Me.RecordSource = sQueryName
End Sub
I have placed a command button on a form to duplicate a record in an effort reduce typing. When I click on the duplicate button, Access return a Run-time error 3075 and open the Visual Basic editor and highlighting this line of code.
Set qdef = CurrentDb.CreateQueryDef(sQueryName, "Select * from TripBook where route = " & Me.cboRoute)
Here is the complete code. This code is not related to the command button. This is a combo box. Why is the error pointing to this line? The combo box works fine.
Private Sub cboRoute_AfterUpdate()
Dim qdef As querydef
Dim sQueryName As String
sQueryName = "qryRt_1"
Me.RecordSource = ""
DoCmd.DeleteObject A_QUERY, sQueryName
Set qdef = CurrentDb.CreateQueryDef(sQueryName, "Select * from TripBook where route = " & Me.cboRoute)
Me.RecordSource = sQueryName
End Sub