I have created the following piece of code to update a database (I am kind of new at this) but it fails with the above error. If I put the insert statement into a SQL window with the right values - it works fine. Here is the statement:
Dim UserProjName As String
Dim DRSiRecordType As Long
Dim DRSiResultNumber As Long
Dim DRSsDescription As String
Dim Year As Long
Dim Month As Long
Dim Amount As Long
Bunch of other stuff.....
sSql = "INSERT INTO Occupancy ( UserProjName, DRSiRecordType, DRSiResultNumber, DRSsDescription, Year, Month, Amount ) values (""" & UserProjName & """," & DRSiRecordType & "," & DRSiResultNumber & ",""" & DRSsDescription & """," & Year & "," & Month & "," & Amount & "
"
l_cmdExecuteSQL.ActiveConnection = CurrentProject.Connection
l_cmdExecuteSQL.CommandText = sSql
l_cmdExecuteSQL.Execute
From the debugger window - it is building this query:
"INSERT INTO Occupancy ( UserProjName, DRSiRecordType, DRSiResultNumber, DRSsDescription, Year, Month, Amount ) values ("135",10000,6,"Mall Shop GLA Occ. Area SqFt",2002,1,286316)"
Thanks in advance,
Melissa
Dim UserProjName As String
Dim DRSiRecordType As Long
Dim DRSiResultNumber As Long
Dim DRSsDescription As String
Dim Year As Long
Dim Month As Long
Dim Amount As Long
Bunch of other stuff.....
sSql = "INSERT INTO Occupancy ( UserProjName, DRSiRecordType, DRSiResultNumber, DRSsDescription, Year, Month, Amount ) values (""" & UserProjName & """," & DRSiRecordType & "," & DRSiResultNumber & ",""" & DRSsDescription & """," & Year & "," & Month & "," & Amount & "
l_cmdExecuteSQL.ActiveConnection = CurrentProject.Connection
l_cmdExecuteSQL.CommandText = sSql
l_cmdExecuteSQL.Execute
From the debugger window - it is building this query:
"INSERT INTO Occupancy ( UserProjName, DRSiRecordType, DRSiResultNumber, DRSsDescription, Year, Month, Amount ) values ("135",10000,6,"Mall Shop GLA Occ. Area SqFt",2002,1,286316)"
Thanks in advance,
Melissa