open Access Form from hyperlink with filter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LODIE
    New Member
    • Aug 2007
    • 6

    open Access Form from hyperlink with filter

    I have tried to search the forum but kept getting blank page so I apologise if this has already been posted somewhere.

    I am a GIS officer and we use a mapping software called Exponare Public which is web based and allows non mapping people to view our datasets without being able to change them.

    Within this software we can do hyperlinks out. What I would like to do is have a link which opens up a form with all the asset information in it, including photos and maintenance etc.

    looking around I have found that the best way probably to do this is write the asset ID out into a command line switch, witch will then open up the database and hopefully write the asset ID in so that the form opens to the correct data.

    The command line is;
    "\\kangaroo\gro ups\$Technical Services\Asset Management\$Cur rent AM Documents\Asset Condition Assessments\Bui ldings Condition Assessments\con dition assesment 2007\Gannawarra V3.mdb" /cmd "12"

    where i am opening a mdb called gannawarra V3 and trying to pass the asset_ID of 12 into the db.

    Within the MDB I have writen a function as follows:

    Function CheckCommandLin e()
    Dim stLinkCriteria As String
    stLinkCriteria = Command()
    DoCmd.OpenForm "assets", , , "[AssetID] = " & stLinkCriteria
    End Function\

    I then have an autoexec macro which runs the function.

    This is as far as I get as it doesn't seem to be passing the asset id in at all. I have tried variant, string and integer but none of them work. it is crashing at the asset ID = "part with a runtime error '3075' syntax error (missing operator_ in query expression '[AsserID] = '

    Not sure where is is wrong, If anyone has done this before and can help out that would be absolutly fantastic, if anyone has any other way to do this that would be apreciated too.

    Cheers,

    Laura
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    Hmm, never used Access with a command line interface, but there's an alternative.
    Just create a textfile holding the assetID and link a table to that file.
    (This file will have to be filled/overwritten from your application with the correct ID)
    Create a query where you JOIN the linked textfile field with the table holding the data.
    This query can be used for your form.
    Next create the database and set in the startup your form as the first to be displayed.

    Now you're able to fill the textfile and start the database to show the value.

    Getting the idea ?

    Nic;o)

    Comment

    • LODIE
      New Member
      • Aug 2007
      • 6

      #3
      Thanks Nico, I will give it a go, sounds simple enough.

      Comment

      • nico5038
        Recognized Expert Specialist
        • Nov 2006
        • 3080

        #4
        Don't hesitate to post when stuck :-)

        Nic;o)

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #5
          Originally posted by LODIE
          I have tried to search the forum but kept getting blank page so I apologise if this has already been posted somewhere.

          I am a GIS officer and we use a mapping software called Exponare Public which is web based and allows non mapping people to view our datasets without being able to change them.

          Within this software we can do hyperlinks out. What I would like to do is have a link which opens up a form with all the asset information in it, including photos and maintenance etc.

          looking around I have found that the best way probably to do this is write the asset ID out into a command line switch, witch will then open up the database and hopefully write the asset ID in so that the form opens to the correct data.

          The command line is;
          "\\kangaroo\gro ups\$Technical Services\Asset Management\$Cur rent AM Documents\Asset Condition Assessments\Bui ldings Condition Assessments\con dition assesment 2007\Gannawarra V3.mdb" /cmd "12"

          where i am opening a mdb called gannawarra V3 and trying to pass the asset_ID of 12 into the db.

          Within the MDB I have writen a function as follows:

          Function CheckCommandLin e()
          Dim stLinkCriteria As String
          stLinkCriteria = Command()
          DoCmd.OpenForm "assets", , , "[AssetID] = " & stLinkCriteria
          End Function\

          I then have an autoexec macro which runs the function.

          This is as far as I get as it doesn't seem to be passing the asset id in at all. I have tried variant, string and integer but none of them work. it is crashing at the asset ID = "part with a runtime error '3075' syntax error (missing operator_ in query expression '[AsserID] = '

          Not sure where is is wrong, If anyone has done this before and can help out that would be absolutly fantastic, if anyone has any other way to do this that would be apreciated too.

          Cheers,

          Laura
          Hello Laura!

          The following code will Open the Northwind Database in the C:\Test Directory and pass to it the Command Line Argument (/cmd) of "Fuller". Employees is designated as the Start Up Form, and when it opens Code placed in the Open() Event of the Employees Form will create a Filter based on the LastName Field. The Filter will read the value of the Command() Function, create the Filter based on it, then display the appropriate Record, namely [LastName] = 'Fuller'. The code has been tested and is fully operation. Hopefully it will point you in the right direction.
          Code:
          "C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "C:\Test\Northwind.mdb" /cmd "Fuller"
          Code:
          Private Sub Form_Open(Cancel As Integer)
            Me.Filter = "[LastName] = '" & Command & "'"
            Me.FilterOn = True
          End Sub
          P.S. - As previously stated by Nico, we are here if you get stuck.

          Comment

          • LODIE
            New Member
            • Aug 2007
            • 6

            #6
            Thanks Adezii,

            I ended up adapting the Northwind solution that you put up. It worked perfectly once I made some adjustments to my start up script so that it would only open up the form if command existed.

            However, stupid me was thinking that just because I could get the command to work from a dos prompt it would work no problems from Exponare. Obviously this was not the case. Exponare runs as a web browser, and although I had hotlinked already to excel and word docs, I forgot that they were opening up in Explorer, not in their native programs.

            Unfortunately access doesn't do this. So unless I want to convert all my pretty, complicated forms into data access pages and open them over the internet (which always causes security problems with pop ups) I can't do a hyperlink to access from a web browser.

            Does anyone have any ideas????

            Thanks heaps for your help already, I will use this solution in something just so all the time I wasted isn't actually wasted :)

            Cheers,

            Laura

            Comment

            • ADezii
              Recognized Expert Expert
              • Apr 2006
              • 8834

              #7
              Originally posted by LODIE
              Thanks Adezii,

              I ended up adapting the Northwind solution that you put up. It worked perfectly once I made some adjustments to my start up script so that it would only open up the form if command existed.

              However, stupid me was thinking that just because I could get the command to work from a dos prompt it would work no problems from Exponare. Obviously this was not the case. Exponare runs as a web browser, and although I had hotlinked already to excel and word docs, I forgot that they were opening up in Explorer, not in their native programs.

              Unfortunately access doesn't do this. So unless I want to convert all my pretty, complicated forms into data access pages and open them over the internet (which always causes security problems with pop ups) I can't do a hyperlink to access from a web browser.

              Does anyone have any ideas????

              Thanks heaps for your help already, I will use this solution in something just so all the time I wasted isn't actually wasted :)

              Cheers,

              Laura
              I think what it basically boils down to is that you cannot pass the /cmd Switch to an Access Database via a Hyperlink, at least to the best of my knowledge. Can Exponare pass a Cookie or Text File to the Client's PC that the Start Up Form can read? (Long Shot, I know!)

              Comment

              Working...