mbentley
Registered User.
- Local time
- Today, 08:00
- Joined
- Feb 1, 2002
- Messages
- 138
When I run the following code I get an error (see attachment) at the last line. I've checked that all the table and field references are correct. Can anyone see a problem anywhere? (Note that GetBackendPath is a function that finds the path to the table, and it works fine. frmCurrent is a Form variable identifying the form that called the subroutine):
Dim cnnLayout As ADODB.Connection, rstLayout As ADODB.Recordset, strSQL As String
strSQL = "SELECT PatientID, DiagnosticType, ReportSection, Position, DefaultPosition " & _
"FROM tbl_Admin_AssessmentReportLayout " & _
"WHERE PatientID=" & frmCurrent.txtPatientID & _
" ORDER BY Position DESC"
Set cnnLayout = New ADODB.Connection
With cnnLayout
.Provider = CurrentProject.Connection.Provider
.ConnectionString = GetBackendPath("tbl_Admin_AssessmentReportLayout")
.Open
End With
Set rstLayout = New ADODB.Recordset
rstLayout.Open strSQL, cnnLayout, adOpenDynamic, adLockOptimistic
Dim cnnLayout As ADODB.Connection, rstLayout As ADODB.Recordset, strSQL As String
strSQL = "SELECT PatientID, DiagnosticType, ReportSection, Position, DefaultPosition " & _
"FROM tbl_Admin_AssessmentReportLayout " & _
"WHERE PatientID=" & frmCurrent.txtPatientID & _
" ORDER BY Position DESC"
Set cnnLayout = New ADODB.Connection
With cnnLayout
.Provider = CurrentProject.Connection.Provider
.ConnectionString = GetBackendPath("tbl_Admin_AssessmentReportLayout")
.Open
End With
Set rstLayout = New ADODB.Recordset
rstLayout.Open strSQL, cnnLayout, adOpenDynamic, adLockOptimistic
Attachments
Last edited: