how to open another database from a cmd button?

kate10123

Registered User.
Local time
Today, 07:22
Joined
Jul 31, 2008
Messages
185
Hi there,

I have a form in a database with a button. On clicking that button I want another database file to open.

Any ideas how I can do this?

Thanks

Kate :)
 
I have an idea;
Code:
Public Function StartDatabase(strFilename As String)

    Dim strCurDir   As String
    
    If Len(Nz(Dir(strFilename))) = 0 Then
        MsgBox "Database not found.", vbExclamation, "Oops!"
    Else
        Shell "msaccess.exe """ &  strFilename & """", vbMaximizedFocus
    End If

End Function
Enjoy!
 
Guus

Dir never returns a null, so why trap that?
Len(Nz(Dir(strFilename))) = 0
Is an overly complicated way of doing
Nz(Dir(strFilename)) = ""

And because Dir will never return a null anyway...
Dir(strFilename) = ""
 
Guus

Dir never returns a null, so why trap that?
Len(Nz(Dir(strFilename))) = 0
Is an overly complicated way of doing
Nz(Dir(strFilename)) = ""

And because Dir will never return a null anyway...
Dir(strFilename) = ""
Oke, you got me.
But:
Code:
Len(Dir(strfilename)) = 0
is better then
Code:
Len(Nz(Dir(strfilename))) = 0
and faster than
Code:
Dir(strfilename) = ""

A computer is better in mathmatics than string comparison

HTH:D
 
Is it also faster after doing the len first??

We are talking milli if not nano seconds on a single operation thought...
Your 'averege' user is not going to notice...
 

Users who are viewing this thread

Back
Top Bottom