303factory
Registered User.
- Local time
- Today, 21:32
- Joined
- Oct 10, 2008
- Messages
- 136
I've recently attempted to migrate from an Access back end to a Microsoft SQL Server Express 2007 back end. I've linked up the tables to my Access front end client no problem, and anything that gets data using an Access query works fine. However when I try and open a recordset using code I get an error
'ODBC--connection to 'MIDSQL' failed' (where MIDSQL is the name of my ODBC connection)
I'm using the following code, which all works fine with my old Access back end.
(connection declaration)
Code causing debug:
Anyone have any idea why I'm getting this problem? Is my code no longer valid with a SQL server back end?
Thanks
303
'ODBC--connection to 'MIDSQL' failed' (where MIDSQL is the name of my ODBC connection)
I'm using the following code, which all works fine with my old Access back end.
(connection declaration)
Code:
Set gMIDdbase = New ADODB.Connection
With gMIDdbase
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = CurrentProject.Connection
.Open
End With
Code causing debug:
Code:
Dim rstRS As ADODB.Recordset
strSQL = "SELECT * FROM tblExhibitInfo WHERE JobRef =" & Chr(34) & Me.JobRef & Chr(34) & " AND Exhibit =" & Chr(34) & Me.Exhibit & Chr(34)
Set rstRS = New ADODB.Recordset
rstRS.Open strSQL, gMIDdbase, adOpenKeyset, adLockOptimistic, adCmdText
Anyone have any idea why I'm getting this problem? Is my code no longer valid with a SQL server back end?
Thanks
303