Results 1 to 6 of 6

Thread: Command Buttons

  1. #1
    Join Date
    Nov 2004
    Location
    Seattle Area
    Posts
    4

    Command Buttons

    I'm setting up a database that will be used as a "portal" to documentation on a shared drive. I've been able to set up hyperlinks with no issues but I would like to create a command button that would link directly to the application name. In the past, I have designed forms that use command buttons via queries that would open a form but would require some sort of search critera. What I am looking for is to have buttons listed for each of the 40+ applications and when clicking on it, it would go to that page without entering any search critera. I can do it by creating seperate queries and forms for each of the applications and I would rather not create 40 of them...anybody have any ideas?

  2. #2
    Join Date
    Dec 2004
    Location
    Washington DC
    Posts
    2

    Post VBA Application Integration Code

    Jim:::

    I think I have what you are looking for by way of VBA code.

    If you are trying to do in code what I THINK you are trying to do, the code I have supplied will open up a file directly (via its exe) through an MS Access event procedure.

    The only caveat here is that if you are connecting your DB through the network ensure that the file paths are generic enough so that any PC's operating system can access them. In other words, ensure that your file links are accessed from off the ROOT directory of the server.

    There are a few variations on this code but try this code and let me know if it's what you are looking for...

    ****CODE***********
    Private Sub btn001_Click()
    On Error GoTo Resolve

    Dim stAppName As String
    'Ex: C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe c:\AdminDocs\hrdoc1.pdf"
    stAppName = "file path of executable placed here then a space then the COMPLETE file path of the document you wish to open"

    Call Shell(stAppName, 1)
    Exit Sub

    'Error handler
    Resolve:
    Msgbox "ERROR: Cannot identify link to application module", _
    vbCritical + vbOKOnly, "Runtime Error"
    End Sub

    ---Brice Richard

  3. #3
    Join Date
    Nov 2004
    Location
    Seattle Area
    Posts
    4
    Not exactley but that does solve another issue...thanks for that!

    No, what I need is a way to click on a command button that would take the user to another form that contains information regarding a given application. Currently, I have command buttons that invoke queries (IE: Click on button, and a prompt comes up and says "Enter User Name") that take you to a form showing the user information. I want to eliminate the one step that the user needs to enter any info and can just click on a button and go the information form. I can do it but it would mean creating a seperate query for each of the application that I want to access...

  4. #4
    Join Date
    Jun 2004
    Posts
    41
    Have you thought about using the "On Got Focus" property of the Option Group controls (option buttons/check boxes/toggle buttons)to open your forms. The command button wizard with give you the sample code.

    The Option Group makes it easy to add new options. Just go to the last option and do a copy and paste. Then all you have to do is modify the "option value" and "Name" property of the new option.

  5. #5
    Join Date
    Dec 2004
    Location
    Washington DC
    Posts
    2

    Open Form Code

    What Licky suggested in using wizards is one way to create code for opening forms.

    Another way which is comparable in RAD is to use the following (very basic) code to open a form:

    ******CODE**********
    Private Sub CmdBtn1_Click()
    DoCmd.OpenForm "form name here with quotation marks", acNormal
    End Sub

  6. #6
    Join Date
    Nov 2004
    Location
    Seattle Area
    Posts
    4
    Thank you both, Brice and Licky. I am going to run this by my team mate and see what he thinks.

Posting Permissions

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