Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Question Unanswered: Trying to open a form in Acces by the click of a button in Excel

    I am working on a project in which I want to be able to click a button on excel and by the click of the button, a specfic access database should open and a form in access should automatically open. Please advice and help. I have already created the button in excel which opens access database, but how do I get it to open a specific access database and that too a form in access?

    thanks.

  2. #2
    Join Date
    Nov 2003
    Posts
    9
    Hullo. This should not be too difficult. Create a macro in said database to display the form in question. Then, in Excel, modify the code that launches your Access instance. Put this: databasename.mdb /X MacroName at the END of that line, (just after Access.EXE). This will launch the database you name, and run the macro called for.

    HTH

    P

  3. #3
    Join Date
    Mar 2004
    Posts
    2
    Originally posted by Philem
    Hullo. This should not be too difficult. Create a macro in said database to display the form in question. Then, in Excel, modify the code that launches your Access instance. Put this: databasename.mdb /X MacroName at the END of that line, (just after Access.EXE). This will launch the database you name, and run the macro called for.

    HTH

    P
    Thanks for your reponse, first of all I have created a button on excel but I am not able to open the acess database for some reason. I have placed the database in C:\testing.mdb, the code that I have to open the database by clicking the button in excel is as follows and doesn't seem to be working? can u please help. thanks

    Private Sub Button351_Click()
    On Error GoTo Err_Button351_Click

    Dim stAppName As String

    stAppName = "Access.mdb c:\jaim.mdb"
    Call Shell(stAppName, 1)

    Exit_Button351_Click:
    Exit Sub

    Err_Button351_Click:
    MsgBox Err.Description
    Resume Exit_Button351_Click

    End Sub

    This appears in excel to open the jaim.mdb database. it cliams file not found. can u provide a i.e if not much trouble. Thanks.

  4. #4
    Join Date
    Oct 2003
    Posts
    29
    ' This just turns on and off alerts about overwirting a file
    Application.DisplayAlerts = True

    'This is where you set up your directory. I have a network directory set up here with the database name at the end called Error Log Database.mdb.

    Const strConPathToSamples
    "\\Maverick\sfactory\SolFactory\Development_Factor y\Projects\Transformation Project\Quick Tools\Tool Development\Error Log\Error Log Database.mdb"


    strDB = strConPathToSamples & "Error Log Database.mdb"


    ' Create new instance of Microsoft Office Access.
    Set appAccess = CreateObject("Access.Application")

    ' Open database in Microsoft Office Access window. appAccess. OpenCurrentDatabase strConPathToSamples


    ' Open form.
    'You can't forget to make the database visible. If you forget this. If you went to where the database is on the drive, you'll notice the .ldb was created meaning that the database is opened, you just can't see it.

    appAccess.Visible = True



    Hope this helps!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •