Can´t open access DB from listbox

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,216
Office Version
  1. 2016
Hi guys,

I got following code to open a database within a form.

Unfortunatelly I am not able to open the file.

The reference is ok as I am using the same code to reference tables within the selected database..

Code:
Private Sub lstDateien_DblClick(Cancel As Integer)
    Dim dbsExtern As Database
    
    Set dbsExtern = OpenDatabase(CodeProject.Path & "\" & m_strDatei, , True)
    
[COLOR=#ff0000]'Methode or dataobject not found[/COLOR]
    [COLOR=#ff0000]dbsExtern.Visible = True[/COLOR]

   
End Sub

Thanks for looking!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Albert

I don't think OpenDatabase works in the way you think/want it to.

It opens the database and adds it to the Databases collection of the workspace.

You can then work with the objects, eg tables, queries etc, in the database.

It doesn't open the database as though you had double clicked on it or opened via the File menu in Access.

PS The Database object doesn't have a Visible property.
 
Upvote 0
Hi Norie,
yes I saw that it had not a visible property.. hmm but thought there is a way of open a database from within a form..

So there is no way of doing this?

The thing is that I already created a userform listbox which list me all the databases within a certain Directory.. so would be nice if that can be opend straigt from there..
 
Upvote 0
Albert

Do you want to open the selected database to allow the user to interact with it?

Where is your listbox located?
 
Upvote 0
Norie,
I got the listbox in a access form.
I like to vie tables and queries in other listboxes in that form most of it works already... however I like to be able to open it from that form if I need to make some
changes to that selected database...
Some of them are password protected some not so the only interaction would be to be able to enter the password.
 
Upvote 0
But you want to open the actual database to work with it rather than just access its data?
 
Upvote 0
what I supose to be doing with all these data is find three tables in each of those databases and then store it somewhere to check wheter I got dublikate data somewhere.
Problem... not all table are called the same.
For instants I got customers, objects and employees...and linked table objectEmployee so basically who has worked on what object at what date and time

Now I need to find all databases which are containing any information about that.
Save it somewhere and then find any dublikate data..

Problem is that not all databases have the exact field names to make it difficult to have a one sub or functions to import all of the data.. So therefore I might need to change the field names or create qry to get me the data..
still not quite sure what the best way of doing it
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,876
Members
449,056
Latest member
ruhulaminappu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top