[AccessD] Opening MS Access db from VB

Bryan Carbonnell carbonnb at sympatico.ca
Tue Oct 14 05:28:42 CDT 2003


On 14 Oct 2003 at 15:43, SWEENEY Michael wrote:

> I am trying to open an access DB from within a VB app. All i want to
> acheive is to have the db open in its own right.
> 
> It would seem pretty simple but my head just cant get it....
> 
> Here is the code I used which opens access but not the the actual db.
> 
> Dim mydb as database
> Dim str1 as string
> 
> str1 = "File location to the mdb"
> DBEngine.DefaultUser = "Admin"
> DBEngine.DefaultPassword = " "
> set mydb = DBEngine.Opendatabase(str1)
> 
> I know I am missing something but cant work out what....Any help is
> appreciated.

Are you actually trying to open the db so you can go into Access' GUI 
and manipulate the db that way?

Or are you trying to open it to manipulate it in code?

If you are trying to do the first, I *THINK* you will need to use the 
shell command.

If you are trying for the second way, here is the DAO code we use in 
the BEU:

'Open the Workspace
Set mwks = CreateWorkspace("BEU", cstrUName, cstrPWord)
'Set Reference to BE, opened Exclusively
Set mdbBE = mwks.OpenDatabase(Me.BEPath, True, False, Me.BEPassword)

--
Bryan Carbonnell - carbonnb at sympatico.ca
You're just jealous because the voices only talk to me.




More information about the AccessD mailing list