G
Guest
Hello-
I am trying to run the code below and have had problems. Any ideas as to
why the code is not working?
Here are a few details that may be helpful:
- Debugging error is happening on this piece of code: Set rst =
db.OpenRecordset(strSQL)
-I have tested the query (strSQL) several times in the access query editor
and have had no problems getting it to run.
-If I remove the query and just pull the first line directly from the table,
I have not problems.
-The table is a linked table via ODBC. If I create a local table (.mdf) the
code works fine.
Please Help!
Here is the code:
Private Sub ClientName_AfterUpdate()
Me.clientId.Requery
'-----------------------------Caption Name Code-----------------------------
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim m1 As String
Dim m2 As String
Dim m3 As String
Dim m4 As String
Dim m5 As String
Dim m6 As String
Dim m7 As String
Dim m8 As String
Dim m9 As String
Dim m10 As String
strSQL = "SELECT
metric1,metric2,metric3,metric4,metric5,metric6,metric7,metric8,metric9,metric10" & _
" FROM clientSettings" & _
" WHERE (((clientSettings.clientId)=" & _
[Forms]![3-1_modAdVariables]![clientId] & "))"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL)
'Set rst = db.OpenRecordset("clientSettings")
I am trying to run the code below and have had problems. Any ideas as to
why the code is not working?
Here are a few details that may be helpful:
- Debugging error is happening on this piece of code: Set rst =
db.OpenRecordset(strSQL)
-I have tested the query (strSQL) several times in the access query editor
and have had no problems getting it to run.
-If I remove the query and just pull the first line directly from the table,
I have not problems.
-The table is a linked table via ODBC. If I create a local table (.mdf) the
code works fine.
Please Help!
Here is the code:
Private Sub ClientName_AfterUpdate()
Me.clientId.Requery
'-----------------------------Caption Name Code-----------------------------
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim m1 As String
Dim m2 As String
Dim m3 As String
Dim m4 As String
Dim m5 As String
Dim m6 As String
Dim m7 As String
Dim m8 As String
Dim m9 As String
Dim m10 As String
strSQL = "SELECT
metric1,metric2,metric3,metric4,metric5,metric6,metric7,metric8,metric9,metric10" & _
" FROM clientSettings" & _
" WHERE (((clientSettings.clientId)=" & _
[Forms]![3-1_modAdVariables]![clientId] & "))"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL)
'Set rst = db.OpenRecordset("clientSettings")