Thread: DAO Problem
View Single Post
  #1 (permalink)  
Old 02-13-04, 10:38
aldo_2003 aldo_2003 is offline
Registered User
 
Join Date: Nov 2003
Location: Edinburgh
Posts: 149
DAO Problem

Hi Folks,

Having a problem running some DAO in Excel 97.

Here is the code :

''Function to set a DAO recordset from anywhere in the project
Public Function SetRecordset() As Boolean

Dim ws As Workspace
Dim db As Database
Dim rs As Recordset
Dim strConnection As String
Dim strSQL As String

Set ws = DBEngine.Workspaces(0)

strConnection = "ODBC;DSN=MYDATA"

Set db = ws.OpenDatabase("", False, False, strConnection)

Set rs = db.OpenRecordset("select * from tblData")

ws.Close

End Function


I know I'm connecting ok but I keep getting type mismatch errors and can't seem to tell why.

Cheers
Reply With Quote