Ello everyone,
Ok i've just upsized the database to SQL Server 2005, here is the code:
Set con = Application.Cur rentProject.Con nection
Set rs = New ADODB.Recordset
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimisti c
sql = "INSERT INTO reminders (CompanyID, [Company Name], [Company Contact], Number, Appointtime, Appointdate, [User]) VALUES ('" & idnum.Value & "','" & [Company Name].Value & "','" & [Contact Name].Value & "','" & Telephone.Value & "','" & remtime & "', '" & Format([Recall Date].Value, "mm/dd/yyyy") & "','" & User & "')"
rs.Open sql, con, , , adCmdText
--------------------------------------------------
Which generates this query:
INSERT INTO reminders (CompanyID, [Company Name], [Company Contact], Number, Appointtime, Appointdate, [User]) VALUES ('35243','Some Company','Mr Smith','00000 - 000000','09:00: 00', '03/26/2008','MRF')
If I use rs.open sql,con,,,adcmd text it dies with Error in insert statement
If I open the Server manager and create a query using the above string it works fine!
Why?
Am I being stupid here?
Sorry quick edit here, the data is coming from Linked tables so this front end should already be connected fine.
Ok i've just upsized the database to SQL Server 2005, here is the code:
Set con = Application.Cur rentProject.Con nection
Set rs = New ADODB.Recordset
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimisti c
sql = "INSERT INTO reminders (CompanyID, [Company Name], [Company Contact], Number, Appointtime, Appointdate, [User]) VALUES ('" & idnum.Value & "','" & [Company Name].Value & "','" & [Contact Name].Value & "','" & Telephone.Value & "','" & remtime & "', '" & Format([Recall Date].Value, "mm/dd/yyyy") & "','" & User & "')"
rs.Open sql, con, , , adCmdText
--------------------------------------------------
Which generates this query:
INSERT INTO reminders (CompanyID, [Company Name], [Company Contact], Number, Appointtime, Appointdate, [User]) VALUES ('35243','Some Company','Mr Smith','00000 - 000000','09:00: 00', '03/26/2008','MRF')
If I use rs.open sql,con,,,adcmd text it dies with Error in insert statement
If I open the Server manager and create a query using the above string it works fine!
Why?
Am I being stupid here?
Sorry quick edit here, the data is coming from Linked tables so this front end should already be connected fine.
Comment