DaveMac1960
IS-IT--Management
All,
I have the unfortunate circumstance of building a search/add/edit front end for an Access database. This is my first time doing this and it really makes me appreciate Microsoft SQL Server.
Anyway, I'm trying to insert a record and I keep getting the "data type mismatch" error. All the columns are defined as "text" and "Allow zero length" is set to yes on everything. I have looked and looked at my SQL statement and everything looks fine there (see below).
Can anyone steer me in the right direction?
Thanks in advance.
------------------------------------------------
sSQL = "INSERT INTO 2001_DBASE_KS " _
& "VALUES(" & "'" & FName & "', " & "'" & MI & "', " & "'" & LName & "', " _
& "'" & TCG & "', " & "'" & Suffix & "', " & "'" & Salutation & "', " & "'" & Company & "', " _
& "'" & Specialty & "', " & "'" & BusAddr1 & "', " _
& "'" & BusAddr2 & "', " & "'" & BusCity & "', " & "'" & BusState & "', " & "'" & BusCity & "', " _
& "'" & BusZip & "', " & "'" & BusPhone & "', " & "'" & BusFax & "', " & "'" & EMAIL & "', " _
& "'" & HAddr1 & "', " & "'" & HAddr2 & "', " & "'" & HCity & "', " & "'" & HState & "', " _
& "'" & HZip & "', " & "'" & HPhone & "', " & "'" & HFax & "', " & "'" & CountyCode & "', " _
& "'" & RefID & "', " & "'" & Contact & "', " & "'" & Active & "', " & "'" & upin_num & "', " _
& "'" & SendMail & "', " & "'" & Reason & "' " & ")" _
& "; "
Dim cnn As New OleDbConnection(CnnString)
cnn.Open()
cmd = New OleDbCommand(sSQL, cnn)
cmd.ExecuteNonQuery()
cnn.Close()
I have the unfortunate circumstance of building a search/add/edit front end for an Access database. This is my first time doing this and it really makes me appreciate Microsoft SQL Server.
Anyway, I'm trying to insert a record and I keep getting the "data type mismatch" error. All the columns are defined as "text" and "Allow zero length" is set to yes on everything. I have looked and looked at my SQL statement and everything looks fine there (see below).
Can anyone steer me in the right direction?
Thanks in advance.
------------------------------------------------
sSQL = "INSERT INTO 2001_DBASE_KS " _
& "VALUES(" & "'" & FName & "', " & "'" & MI & "', " & "'" & LName & "', " _
& "'" & TCG & "', " & "'" & Suffix & "', " & "'" & Salutation & "', " & "'" & Company & "', " _
& "'" & Specialty & "', " & "'" & BusAddr1 & "', " _
& "'" & BusAddr2 & "', " & "'" & BusCity & "', " & "'" & BusState & "', " & "'" & BusCity & "', " _
& "'" & BusZip & "', " & "'" & BusPhone & "', " & "'" & BusFax & "', " & "'" & EMAIL & "', " _
& "'" & HAddr1 & "', " & "'" & HAddr2 & "', " & "'" & HCity & "', " & "'" & HState & "', " _
& "'" & HZip & "', " & "'" & HPhone & "', " & "'" & HFax & "', " & "'" & CountyCode & "', " _
& "'" & RefID & "', " & "'" & Contact & "', " & "'" & Active & "', " & "'" & upin_num & "', " _
& "'" & SendMail & "', " & "'" & Reason & "' " & ")" _
& "; "
Dim cnn As New OleDbConnection(CnnString)
cnn.Open()
cmd = New OleDbCommand(sSQL, cnn)
cmd.ExecuteNonQuery()
cnn.Close()