Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing MDB file source via VB app.... 1

Status
Not open for further replies.

adamr1001

MIS
Jul 25, 2001
166
CA

I am a novice VB user, so bear with me.
Thanks in advance to anyone who can help me out here.

I am developing a VB application that must access many different MDB (access) files, one at a time. They all will have the same structure (field, etc...). Can I use a common dialog box to select the MDB file? if so, what's the code for it?

Much appreciated
Adam.
 
Sure you can.

On Error Resume Next
With CommonDialog1
.DialogTitle = "Open"
.CancelError = False
.Filter = "All Files (*.*)|*.*|Database (*.mdb)|*.mdb| "
.ShowOpen
If Len(.Filename) = 0 Then
Exit Sub
End If
sFile = .Filename
End With

Use standard opendatabase code with the variable sFile as the database name.


 
adamr,

Beyond the direct answer, WHY would you have a large number of "identical" ".MDB" files? surely this is a PAIN to deal with and must cause a lot of errors and confusion. Just add the necessary ID field(s) to tables and use them to filter the records individual users see according to the Id scheme related to the (previous) plethora of "same" ".MDB"s.

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top