September 21st, 1999, 09:30 AM
I am trying to develop an application that will keep activities on a SQL server. I have set up a DSN and can connect to it with Access97 and make a passthrough to the SQL Server. However I could not get the RecordSet to open when I use the code below. I can open a standard Access Database, However It will not allow me to open the passthrough to SQl server. Can anyone help me figure this out?
Rodney Wade
rcwade@ems.jsc.nasa.gov
Sub InitializeDatabase(DatabaseLocation)
Set oDatabaseEngine = item.application.CreateObject("DAO.DBEngine.35")
Set oDatabase = oDatabaseEngine.Workspaces(0).OpenDatabase(DatabaseLocation)
If Err.Number <> 0 Then
MsgBox Err.Description & Chr(13) & "OpenDatabase failed"
Exit Sub
End If
End Sub
'************************************************
'Sub GetDatabaseInfo
'
'This subroutine retrieves the Product revenue information
'from the database using the passed in tablename as well as
'field names and the current accountname from the open item.
'You can customize this subroutine to meet your specific needs
'************************************************
Sub GetDatabaseInfo(TableName)
on error resume next
strSQL = "Select * FROM " & TableName
Set oRS = oDatabase.OpenRecordset(strSQL)
If Err.Number <> 0 Then
MsgBox Err.Description & Err.Number & Chr(13) & "OpenRecordset failed"
Exit Sub
End If
oRS.MoveFirst
msgbox oRS.Fields(0) & " " & oRS.Fields(1) & " " & oRS.Fields(2) & " " & oRS.Fields(3) & " " & oRS.Fields(4)
End Sub
Rodney Wade
rcwade@ems.jsc.nasa.gov
Sub InitializeDatabase(DatabaseLocation)
Set oDatabaseEngine = item.application.CreateObject("DAO.DBEngine.35")
Set oDatabase = oDatabaseEngine.Workspaces(0).OpenDatabase(DatabaseLocation)
If Err.Number <> 0 Then
MsgBox Err.Description & Chr(13) & "OpenDatabase failed"
Exit Sub
End If
End Sub
'************************************************
'Sub GetDatabaseInfo
'
'This subroutine retrieves the Product revenue information
'from the database using the passed in tablename as well as
'field names and the current accountname from the open item.
'You can customize this subroutine to meet your specific needs
'************************************************
Sub GetDatabaseInfo(TableName)
on error resume next
strSQL = "Select * FROM " & TableName
Set oRS = oDatabase.OpenRecordset(strSQL)
If Err.Number <> 0 Then
MsgBox Err.Description & Err.Number & Chr(13) & "OpenRecordset failed"
Exit Sub
End If
oRS.MoveFirst
msgbox oRS.Fields(0) & " " & oRS.Fields(1) & " " & oRS.Fields(2) & " " & oRS.Fields(3) & " " & oRS.Fields(4)
End Sub