I am trying to run an update querry that combines two fields from my Database. I am doing it this way as its only way I can figure out how to validate the entries in the form. here is my code . I am getting an error my querry can't be found but I know its saved as I can run it outside my form. is this a limitation of access? Thanks in advance for help
Private Sub Form_AfterUpdate()
Dim dbs As DAO.Database
Dim lngRowsAffected As Long
Dim lngRowsDeleted As Long
Set dbs = CurrentDb
' Execute runs both saved queries and SQL strings
dbs.Execute updatevalfield, dbFailOnError
' Get the number of rows affected by the Action query.
' You can display this to the user, store it in a table, or trigger an action
' if an unexpected number (e.g. 0 rows when you expect > 0).
lngRowsAffected = dbs.RecordsAffected
dbs.Execute "DELETE FROM tblMyTable WHERE Bad", dbFailOnError
lngRowsDeleted = dbs.RecordsAffected
End Sub