Hi
I am writing a program using MSAccess Database (Office2000)I am getting an error when I choose the recordset.The error states unrecognized database format. What am I doing wrong?
thanks
Printable View
Hi
I am writing a program using MSAccess Database (Office2000)I am getting an error when I choose the recordset.The error states unrecognized database format. What am I doing wrong?
thanks
You have to do it the hard way.
Change your references to DAO 3.6 and try something like:
Dim daodb36 As Database
Dim rs As DAO.Recordset
Dim strQuery As String
'set strQuery to table name, query name or SQL string
strDBPath = "c:\dbpath\dbname.mdb"
Set daodb36 = DBEngine.OpenDatabase(strDBPath)
Set rs = daodb36.OpenRecordset(strQuery)
'Read database
with rs
.movefirst
if !fldname1 <> "NULL" then
txtbox1.text = !fldname1
else
txtbox1.text = " "
end if
end with
There is a web page on MSDN that better explains it but this is what I had to do to code with Office 2000 stuff with VB6. Hopefully VB7 will have the updates.
what is the ! used for is that what you have to put in front of the database field name for it to work; just proper syntax?
Bebe, It's called a "bang" (stupid name if you ask me) and it tells VB that what follows belongs to a collection. In this case, it's pointing back to the recordset "rs".