I have a Currentdb.Execute INSERT INTO problem.
In the code I'm using DAO.RecordSet to select a record that I want certain info from that DAO selection to be inserted into another table.
I'm using a strSQL string to set the SELECT of the DAO dynaset. However, all of the fields are name fields which some of the fields are BLANK.
So my "WHERE clause is bombing out. I remember sometime in the past an Expert commenting that if my string could be blank I should us Variant instead of String. SO, I set Dim of vaiables to variant (maybe this is where I'm messing up)
Anyway My dims and section of the code are:
Dim strSQL4 As String
Dim rs4 As DAO.Recordset
Dim LResponse As Integer, LResponse2 As Integer, LResponse3 As Integer
Dim strLName As Variant, strFName As Variant, strMName As Variant, strSufName As Variant, strEntityName As Variant
strLName = rs3!RecLName
strFName = rs3!RecFName
strMName = rs3!RecMName
strSufName = rs3!RecSufName
strEntityName = rs3!RecEntityName
strSQL4 = "SELECT RecPartyID, RecLName, RecFName, RecMName, RecSufName, RecEntityName FROM tbl_Parties WHERE RecLName='" & strLName & "' AND RecFName='" & strFName & "' AND RecMName='" & strMName & "' AND RecSufName='" & strSufName & "' AND RecEntityName='" & strEntityName & "')"
Set rs4 = CurrentDb.OpenRecordset(strSQL4, dbOpenDynaset)
I have a Set rs3 also where the variables are coming from......