Results 1 to 8 of 8

Thread: Loading Access form

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Location
    Wollongong. NSW. Australia
    Posts
    470

    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

  2. #2
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313

    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.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Location
    Wollongong. NSW. Australia
    Posts
    470

    Re: Loading Access form

    G'day,

    Aaaaaaw Pete, you can do better than that! Make something up!!!

    Peter

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Loading Access form

    Actually it is possible but MS Access needs to be automated so here is a quicky for you:
    VB Code:
    1. Public Sub OpenAccessForm(strDB As String, strForm As String)
    2. '=============================================================
    3. Dim AccessDB As Object
    4.  
    5.     Set AccessDB = CreateObject("Access.Application")
    6.     With AccessDB
    7.         .OpenCurrentDatabase strDB
    8.         .DoCmd.OpenForm strForm
    9.         .Visible = True
    10.     End With
    11.  
    12. End Sub
    13.  
    14. 'usage:
    15. Private Sub Command1_Click()
    16.     OpenAccessForm App.Path & "\NWIND.mdb", "Employees"
    17. End Sub

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Location
    Wollongong. NSW. Australia
    Posts
    470

    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.

  6. #6

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Location
    Wollongong. NSW. Australia
    Posts
    470

    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

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Loading Access form

    Quote 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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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
  •  



Click Here to Expand Forum to Full Width