Results 1 to 2 of 2

Thread: problem with vb and MS Access

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Posts
    8

    problem with vb and MS Access

    I've got a button in a vb form and got a MS Access application.

    The MS Access database has many tables, Queries, Forms and Reports.

    When I try to invoke a form or a report or a table from my vb application the MS Access is not running.I've wriiten the code in the click event of a button in VB.The code is as follows:

    ************************************
    Private Axs As Access.Application

    Private Sub Command1_Click()
    Set Axs = CreateObject("Access.Application")
    Axs.OpenCurrentDatabase "c:\windows\desktop\converted_new.mdb", False
    Axs.DoCmd.OpenTable "Customers", acViewNormal, acReadOnly
    End Sub


    ************************************
    also I addes the MS Access 9.0 object library from the VB references.

    on clicking the button in the vb form,the cursor blinks and after sometime it stops blinking and nothing is happening.

  2. #2
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    Should use something like this:

    Dim appAcc As Access.Application

    Private Sub Command1_Click()
    Set appAcc = New Access.Application
    appAcc.Visible = True
    appAcc.RunCommand acCmdAppMaximize
    appAcc.OpenCurrentDatabase "c:\windows\desktop\converted_new.mdb", False
    appAcc.DoCmd.OpenTable "Customers", acViewNormal, acReadOnly
    End Sub

    Hows that?

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