I have a similar issue (somewhat) -- VB6 and Access97

My code in Option Explicit is

Dim dbs2 As Database

In the Private Sub Form_Load(), I have

Set dbs2 = OpenDatabase("C:\Program Files\members\members.mdb",True,False)

The Run Time Error I get is: Couldn't find file 'C:\Program Files\Members\Members.mdb'.
In the Debug: When the cursor hovers over dbs2, the response is dbs2 = Nothing

Can anyone please explain what causes the database not to be recognized. I can open the database in Access97 with no problem and VB6 seems to work alright.


Recommended Answers

Please mark this thread as solved and happy coding :)

Jump to Post

All 4 Replies

if your using adodc and datagrid for the connection this may help

Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " & App.Path & "\database.mdb; Persist Security Info=False; Jet OLEDB:Database Password=PASSWORD"
Adodc1.RecordSource = "Select * from log"
Set DataGrid1.DataSource = Adodc1

replace the capitalize PASSWORD with the password of your database ".mdb"

Please mark this thread as solved and happy coding :)

commented: I wander how they forget that? +4

Thanks but I use Access 2007 VBA and use DAO. I consider this closed though because I cannot use VB6, no thanks to MS.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.