I am getting error sub or function not defined when I am trying to save data into my database using values on controls defined in the form. The application is seeing the control name as a name of function or sub here is the code
Each time I try to run my code , I got the sub or function not defibed on the name of my controls in the form which are companyname, contactid, areaID etc..
Please help
Code:
If isCompanyNameExist(CompanyName) = False Then
strSQL = "INSERT INTO Companies (CompanyID, CompanyName, PostAdr, treetAdr, AreaID, ContactID) " _
& "Values('" & CompanyID & "','" & CompanyName & "','" _
& PostAdr & "','" & StreetAdr & "','" & AreaID & "','" & ContactID & "')"
Else
strSQL = "UPDATE Companies " _
& "SET CompanyID = '" & CompanyID & "',CompanyName = '" & CompanyName & "',PostAdr = '" & PostAdr & "', " _
& "StreetAdr = '" & StreetAdr & "' ,AreaID = '" & AreaID & "',ContactID = '" & ContactID & "' " _
& "DateModified = '" & SQLFormatDate(DateModified) & "', ModifiedBY = '" & CurrentProject.Connection.Properties("USER ID") & "' " _
& "WHERE CompanyID = '" & CompanyID & "'"
End If
If ValueIn = False Then
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings False
End If
Please help
Comment