Access update table from form values
I've been searching and searching to no avail. I am trying to update a table from form values in Access 2k. In the following code "tblCatalog" is the table to be updated. "Me." is a form opened from frmEntryForm as a pop-up to choose the parent record.
Private Sub Choose_Synonym_Click()
On Error GoTo Err_Choose_Synonym_Click
DoCmd.RunSQL "UPDATE tblCatalog" & _
" SET tblCatalog.ParentID = """ & Me.PKey & _
""" WHERE tblCatalog.PKey = """ & Forms![frmEntryForm]![tblCatalog.PKey] & """"
DoCmd.Close
Exit_Choose_Synonym_Click:
Exit Sub
Err_Choose_Synonym_Click:
MsgBox Err.Description
Resume Exit_Choose_Synonym_Click
End Sub
I get a "datatype mismatch on criteria expression" and can't figure out why (everything is Long Integer). I have the expression Forms![frmEntryForm]![tblCatalog.PKey] as a bound textbox in the pop-up form and it works. Maybe there is a better way to do this?
thanks in advance!
|