Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Bookmark function (AXP)

    I have some code that allows a user to double click on a field, which in turn opens another form. The subsequent form shows all of the data. The new form opens with all of the applicable records. What I want to do is open everything but go to the original record that was clicked. I think there is something like a bookmark function. Does anyone know how to work this?

    Thanks,
    Mark

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bookmark function (AXP)

    You write "go to the original record that was clicked". I suppose you want to go to the record that corresponds to the original record that was clicked - the original record is in the form you have just left.

    You will need to have a unique key - a field or combination of fields that uniquely identifies the record. Let's say you have a Primary Key on a numeric field named RecordID (it could be an AutoNumber field). Pass the value of this field in the OpenArgs argument of DoCmd.OpenForm:

    DoCmd.OpenForm "frmAnotherForm", , , , , , Me.[RecordID]

    Use this in the OnOpen or OnLoad event procedure of the form you open:

    Private Sub Form_Load()
    Dim rst As DAO.Recordset

    ' Get out if OpenArgs not specified, e.g. if form is opened directly
    If IsNull(Me.OpenArgs) Then Exit Sub

    Set rst = Me.RecordsetClone
    rst.FindFirst "[RecordID]=" & OpenArgs
    If rst.NoMatch = False Then
    Me.Bookmark = rst.Bookmark
    End If

    Set rst = Nothing
    End Sub

    This code uses a DAO recordset, so set a reference to the Microsoft DAO 3.6 Object Library - use Tools/References... from the Visual Basic Editor.

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmark function (AXP)

    Thanks!

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Bookmark function (AXP)

    An alternative way to go (not the bookmark way) is to build up the criteria of the OpenForm statement. This way you open the new form at the appropriate record, and if you wish to view the rest of the records the form refers to, just click on the Remove Filter button on the main toolbar.
    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

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