Access 2007, This is a short chunk of code but I am getting a Run-time error 13 Type Mismatch. I think it is the "varJoinID As Variant" syntax in the SQL statement but I am not sure. Shouldn't there be a @ before the variable?
This is for a rough Prototype presentation on Tuesday. So I am forcing some of the variable content. You will see what I mean. I have never dimmed a Var and pulled it into SQL so I am not sure if I have the syntax right.
Code:
Private Sub PersonID_DblClick(Cancel As Integer)
Dim inPersonID As Integer
Dim stName As String
Dim stFieldName As String
Dim varJoinID As Variant
Dim stSQL As String
inPersonID = PersonID
stTableName = "Person_TBL"
stFieldName = "PersonID"
varJoinID = DMax("JoinID", "PropertyPeopleJoin_TBL")
stSQL = "UPDATE PropertyPeopleJoin_Tbl" & " SET PersonTable = '" & stTableName & "', PersonField = '" & stFieldName & "', PersonKey = " & inPersonID & "" & " WHERE JoinID = " & varJoinID & ";"
DoCmd.RunCommand stSQL
I appreciate your help.
Phred