I have created a DSN to a csv file and I am able to use it with WinSQL (so I know that the connection works). When I use the connection in Word VBA, I get an error that I can not use ODBC to import , export or link data to my database. When i use this code for any other type of DSN (eg SQL Lite), it works.
How can I use DAO to query records to my csv file (the file belongs to an application, I can not convert it).
Hereis the code:
'-------------------------------------------------------
Public Function ChkAgent(Fname, Lname As String) As Integer
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = OpenDatabase("", True, True, Connect:="DSN=Agents;")
Set rs = dbs.OpenRecordset("select [first name],[last name] from people.csv where ucase([first name]) =ucase('Jessica') and ucase([last name])=ucase('Smith');")
ChkAgent = rst.RecordCount
Set rs = Nothing
Set db = Nothing
End Function
'--------------------------------------------------------
Thanks
Mike
How can I use DAO to query records to my csv file (the file belongs to an application, I can not convert it).
Hereis the code:
'-------------------------------------------------------
Public Function ChkAgent(Fname, Lname As String) As Integer
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = OpenDatabase("", True, True, Connect:="DSN=Agents;")
Set rs = dbs.OpenRecordset("select [first name],[last name] from people.csv where ucase([first name]) =ucase('Jessica') and ucase([last name])=ucase('Smith');")
ChkAgent = rst.RecordCount
Set rs = Nothing
Set db = Nothing
End Function
'--------------------------------------------------------
Thanks
Mike