Community discussion forum

Calling an MS Access form using VB

Tags: db, vba Cambodia
  • 2 years ago

    Hi guys,

     

    How does one call a form created within an Access database using VB6?

  • 2 years ago

    What you do depends upon whether you want to see the form or use it.

    Try this:

    Dim accObj As New Access.Application
    Dim f As Access.Form
    accObj.OpenCurrentDatabase "C:\db1.mdb", False    'amend to your MDB

    'to display the form for use: 

    accObj.DoCmd.OpenForm "logon", acNormal, , , , acDialog

     

    'or perhaps if you want to make use of the controls on the form... 

    Set f = accObj.Forms("Logon")
    MsgBox f.Controls(0).Name

Post a reply

Enter your message below

Sign in or Join us (it's free).

We'd love to hear what you think! Submit ideas or give us feedback