|
-
Mar 9th, 2005, 03:58 PM
#1
Thread Starter
Hyperactive Member
Loading Access form
G'day,
I open a database with Set CustDb = OpenDatabase("c:\ledger\data\customer.mdb")
How do I load in a form I have created with access.
Peter
-
Mar 9th, 2005, 04:59 PM
#2
Frenzied Member
Re: Loading Access form
Hmmmm. You don't 
Do you want to display an Access form from VB? I don't think that is possible... Sorry.
-
Mar 9th, 2005, 05:29 PM
#3
Thread Starter
Hyperactive Member
Re: Loading Access form
G'day,
Aaaaaaw Pete, you can do better than that! Make something up!!!
Peter
-
Mar 9th, 2005, 06:00 PM
#4
Re: Loading Access form
Actually it is possible but MS Access needs to be automated so here is a quicky for you:
VB Code:
Public Sub OpenAccessForm(strDB As String, strForm As String)
'=============================================================
Dim AccessDB As Object
Set AccessDB = CreateObject("Access.Application")
With AccessDB
.OpenCurrentDatabase strDB
.DoCmd.OpenForm strForm
.Visible = True
End With
End Sub
'usage:
Private Sub Command1_Click()
OpenAccessForm App.Path & "\NWIND.mdb", "Employees"
End Sub
-
Mar 10th, 2005, 01:13 AM
#5
Thread Starter
Hyperactive Member
Re: Loading Access form
G'day Rhino,
Thanks for that. It amost works.
What happens is that as soon as the form loads, it closes again. You may have some ideas, but I suspect my forms and/or database/queries/tables might be part of the problem. I won't have much time over the next few days to test, but will get into it asap.
Peter.
-
Mar 10th, 2005, 09:02 AM
#6
Re: Loading Access form
Hmm ... as long as you don't explicitly EXIT form it should stay so your que and/or table might be part of the problem indeed.
-
Mar 12th, 2005, 09:59 PM
#7
Thread Starter
Hyperactive Member
Re: Loading Access form
G'day Rhino,
I still have the problem of the form closing as soon as it opened, but have got around it by puting a msgbox just before the end sub.
One last question (unitl next time).
The form opens up in Access. Is it possible for access to remail hidden or closed so the user doesn't see all the Access stuff?
Peter
-
Mar 12th, 2005, 11:27 PM
#8
Re: Loading Access form
 Originally Posted by Supremus
One last question (unitl next time).
The form opens up in Access. Is it possible for access to remail hidden or closed so the user doesn't see all the Access stuff?
Peter
No, not to my knowledge. The Forms/Reports etc. are all child objects of the main window Access. 
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
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
|