From an event on a form in db1 I need to open db2 and close db1. Can you point me in the right direction, please.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Open db from a form event (Win XP Office 2003)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Open db from a form event (Win XP Office 2003)
- This topic has 6 replies, 2 voices, and was last updated 16 years, 3 months ago.
Viewing 0 reply threadsAuthorReplies-
WSHansV
AskWoody LoungerFebruary 21, 2009 at 5:20 pm #1148359You can use an instruction like
OpenCurrentDatabase “C:DatabasesInvoice.mdb”
Please note that opening another database will instantly close the database running the code, so the code will end abruptly at the above instruction – all instructions after that line will not be executed any more/
-
WSgsmith
AskWoody Lounger -
WSHansV
AskWoody LoungerFebruary 22, 2009 at 7:28 pm #1148496I apologize – I should have known that OpenCurrentDatabase is only intended to be used when automating Access from another application. You can use code like this instead:
Private Declare Function ShellExecute Lib “shell32.dll” Alias “ShellExecuteA” ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As LongPrivate Const SW_SHOWMAXIMIZED As Long = 3
Private Const SW_SHOWNORMAL As Long = 1Private Sub Details_Click()
ShellExecute 0, “Open”, “C:DatabasesInvoice.mdb”, 0, 0, SW_SHOWMAXIMIZED
Quit
End Sub -
WSgsmith
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSgsmith
AskWoody LoungerFebruary 23, 2009 at 12:58 am #1148548When I ran the code, the only thing that happened was that the original db closed. I re-did it with 2007 and it worked. I went back to 2003, erased everything, and re-did it, and it worked. Who knows? Anyway, it worked, and once again the Woody’s gang has saved a poor programmer. Thank you.
-
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
KB5058379 / KB 5061768 Failures
by
crown
2 hours, 13 minutes ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
2 hours, 21 minutes ago -
At last – installation of 24H2
by
Botswana12
3 hours, 6 minutes ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
1 minute ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
15 hours, 18 minutes ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
8 hours, 37 minutes ago -
Limited account permission error related to Windows Update
by
gtd12345
1 day, 4 hours ago -
Another test post
by
gtd12345
1 day, 4 hours ago -
Connect to someone else computer
by
wadeer
23 hours, 17 minutes ago -
Limit on User names?
by
CWBillow
1 day, 2 hours ago -
Choose the right apps for traveling
by
Peter Deegan
16 hours, 17 minutes ago -
BitLocker rears its head
by
Susan Bradley
18 minutes ago -
Who are you? (2025 edition)
by
Will Fastie
2 hours, 7 minutes ago -
AskWoody at the computer museum, round two
by
Will Fastie
18 hours, 40 minutes ago -
A smarter, simpler Firefox address bar
by
Alex5723
1 day, 15 hours ago -
Woody
by
Scott
2 days ago -
24H2 has suppressed my favoured spider
by
Davidhs
23 hours, 57 minutes ago -
GeForce RTX 5060 in certain motherboards could experience blank screens
by
Alex5723
2 days, 14 hours ago -
MS Office 365 Home on MAC
by
MickIver
2 days, 8 hours ago -
Google’s Veo3 video generator. Before you ask: yes, everything is AI here
by
Alex5723
3 days, 4 hours ago -
Flash Drive Eject Error for Still In Use
by
J9438
3 hours, 42 minutes ago -
Windows 11 Insider Preview build 27863 released to Canary
by
joep517
3 days, 23 hours ago -
Windows 11 Insider Preview build 26120.4161 (24H2) released to BETA
by
joep517
3 days, 23 hours ago -
AI model turns to blackmail when engineers try to take it offline
by
Cybertooth
3 days, 3 hours ago -
Migrate off MS365 to Apple Products
by
dmt_3904
3 days, 4 hours ago -
Login screen icon
by
CWBillow
2 days, 18 hours ago -
AI coming to everything
by
Susan Bradley
9 hours, 8 minutes ago -
Mozilla : Pocket shuts down July 8, 2025, Fakespot shuts down on July 1, 2025
by
Alex5723
4 days, 15 hours ago -
No Screen TurnOff???
by
CWBillow
4 days, 15 hours ago -
Identify a dynamic range to then be used in another formula
by
BigDaddy07
4 days, 16 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.