This is sample db i am working with to test button: the real db will have many more fields.
Table1 = "Asperants" with fields AsperantsID, FirstName and LastName
Table2 = "Clergy" with fields ClergyID, FirstName and LastName
My code is from a form called frmAsperants using a button called comMove
The problem I am having is that i get prompted for the Me.txtAsperantsID number when i run the query. If i manually type in the number the append works. what am i missing to make the query us the current AsperantsID in the form?
Private Sub comMove_Click()
On Error GoTo Err_comMove_Click
Dim strSQL As String
strSQL = "INSERT INTO Clergy(FirstName,LastName)"
strSQL = strSQL + "SELECT Asperants.FirstName, Asperants.LastName "
strSQL = strSQL + "FROM Asperants "
strSQL = strSQL + "WHERE (((Asperants.AsperantsID)=Me.txtAsperantsID));"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
Exit_comMove_Click:
Exit Sub
Err_comMove_Click:
MsgBox Err.Description
Resume Exit_comMove_Click
End Sub