|
-
Jul 3rd, 2000, 05:56 AM
#1
Thread Starter
Lively Member
Hi,
I have the following code which opens a database when my application is first run:
Function OpenDataBase(ByVal pDatabasName As String) As Boolean
On Error GoTo OpenDataBaseError
Set pWorkspace = Workspaces(0)
Set pDatabase = pWorkspace.OpenDataBase(App.Path & "\" & pDatabasName, False, False)
OpenDataBase = True
End Function
This opens the database and I have no problems here. I then later wish to close the database for maintenance and know that the following line closes the database:
pdatabase.close
Now my Question is: How do I reopen the database without it getting upset with pworkspace or any other complications?
Any help is appreciated and thanks in advance.
Mike
-
Jul 3rd, 2000, 06:56 AM
#2
Fanatic Member
Hi spawny
As best as i can remember when you set the Pdatabase to the workspace, it stay's allocated to that untill you set the object to nothing. With that in mind you just need to do the Pdatabase.OpenDatabase command.
I think this is right but i haven't used DAO for quite a while.
Hope this helps
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Jul 3rd, 2000, 10:59 AM
#3
Guru
If pWorkspace and pDatabase is already instantiated from a previous call, the new SET statements will overwrite the existing contents with the new objects. If overwriting is a problem, then you have issues, otherwise don't worry about it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|