aaronbrett
09-25-2008, 03:13 AM
Hi
I have the following code and am getting the Syntax Error in FROM Clause error - could anyone let me know where I am going wrong please?
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String
cn.Open "Provider=Microsoft Jet 4.0 OLE DB Provider;Data Source=I:\Access for Everyone\Weekly Diary\WeeklyDiaryData.mdb;Jet " _
& "OLEDB:Database Password=xxxxx"
strSQL = "SELECT * FROM [DiaryData] WHERE ([DiaryData.MyID] = 2)"
rs.Open strSQL, cn, adOpenKeyset, adLockOptimistic, adCmdTable
' Update current record
rs!Username = "testusername"
rs!Date = "31/12/08"
rs!AMPM = "testAMPM"
rs!Status = "testSTATUS"
rs!Reason = "testREASON"
rs.Update
' Close recordset
rs.Close
'Close Database
cn.Close
Set cn = Nothing
Many thanks for your help.
Aaron
I have the following code and am getting the Syntax Error in FROM Clause error - could anyone let me know where I am going wrong please?
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String
cn.Open "Provider=Microsoft Jet 4.0 OLE DB Provider;Data Source=I:\Access for Everyone\Weekly Diary\WeeklyDiaryData.mdb;Jet " _
& "OLEDB:Database Password=xxxxx"
strSQL = "SELECT * FROM [DiaryData] WHERE ([DiaryData.MyID] = 2)"
rs.Open strSQL, cn, adOpenKeyset, adLockOptimistic, adCmdTable
' Update current record
rs!Username = "testusername"
rs!Date = "31/12/08"
rs!AMPM = "testAMPM"
rs!Status = "testSTATUS"
rs!Reason = "testREASON"
rs.Update
' Close recordset
rs.Close
'Close Database
cn.Close
Set cn = Nothing
Many thanks for your help.
Aaron