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
Printable View
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
Hmmmm. You don't :(
Do you want to display an Access form from VB? I don't think that is possible... Sorry.
G'day,
Aaaaaaw Pete, you can do better than that! Make something up!!! :)
Peter
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
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.
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.
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
No, not to my knowledge. The Forms/Reports etc. are all child objects of the main window Access. :(Quote:
Originally Posted by Supremus