Merry Christmas,
I am try to convert my VB code which use to connect to an MS Access database (V 2.0) and now is an SQL Server db. I know little about it but I've been reading. I seem to have connected properly to the SQL Database and I'm trying to simply confirm I can see the records of a query I wrote that connects to one of the table in the sql db. Here's what I have....
Dim mydatabase As Database
Dim myquerydef As QueryDef
Dim SPTQueryName As String
Dim SQLString As String
Dim ConnectString As String
Set mydatabase = DBEngine.Workspaces(0).Databases(0)
Set myquerydef = mydatabase.CreateQueryDef(SPTQueryName)
ConnectString = "ODBC;DSN=TCMSQL;Description=TCMSQL;UID=TCMUSER;PW D=lyssaeric;DATABASE=TCM;Network=DBMSSOCN"
SQLString = "SELECT JCJob.JobStructure1, JCJob.Name FROM JCJob ORDER BY JCJob.JobStructure1 aSC;"
myquerydef.Connect = ConnectString
myquerydef.SQL = SQLString
"I want to verify I can return records by simply having the first record come up in a message box. It does not see the SQLString when I type:
MsgBox myquerydef![JobStructure1]
myquerydef.Close
It does not see the pass-through query I know but why? Seem like I have to define some recordset.
Steve