• Bookmarking a record for use in another form

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Bookmarking a record for use in another form

    • This topic has 4 replies, 3 voices, and was last updated 24 years ago.
    Author
    Topic
    #355554

    I have a form that consists of two buttons in an option group: Airline and Non Airline (Train or Bus). The fields consist of participant’s name and ride information.

    What I would like to do is to bring up a special form (such as Airline information or Bus/Train information)and clone the recordset from the Transportation form and bookmark it in the Airline form in order to attach the airline information to that particular participant.

    Here’s my code that I created and I keep on getting an error message: “Runtime Error 3077, Syntax Error (Missing Operator) in Expression” and if I remove that line, then I get “No records” error message.

    Here’s my code:

    Private Sub fraTypeOfTransp_Click()
    ‘ Clicking on those buttons will open appropriate form to enter information.

    Dim rst As DAO.Recordset

    Select Case fraTypeOfTransp ‘ Open form based on the value of the option.
    Case 1 ‘Opens Airline form
    DoCmd.OpenForm “frmAirline”

    ‘ Store the recordset for the Transportation form.
    Set rst = Forms!FrmTransp.RecordsetClone

    ‘ Locate the record for the selected participant.
    rst.FindFirst “ParticipantID = ”

    ‘ Set the form’s Bookmark property to move to the record.
    Forms!FrmAirline.Bookmark = rst.Bookmark

    Case 2 ‘Opens NonAirline Form
    DoCmd.OpenForm “frmNonAirline”
    (I’m not finished with Case 2)
    End Select

    End Sub

    Viewing 0 reply threads
    Author
    Replies
    • #524677

      What are you trying to do with this line?[indent]


      ‘ Locate the record for the selected participant.
      rst.FindFirst “ParticipantID = “


      [/indent] You’re telling it to find ParticipantID= and not completing the expression, so it isn’t going to find a match.

      Are the two forms based on the same recordset? If so why are you using two forms? I don’t understand what you’re trying to do here with bookmarks. In an Access recordset, a bookmark is simply a pointer to a specific record. Unless you’re dealing with indentical recordsets, you won’t be able to match bookmarks across forms, nor is there any need to. Just use the OpenArgs argument of DoCmd.OpenForm to pass the Transportation form’s current ParticipantID value to the called form and then in the Open event of the called form, set its filter property to “ParticipantID=” & me.OpenArgs and set the filteron property to true.

      • #524722

        Charlotte,

        Both forms are not based on same table. The frmAirline and frmNonAirline forms are based on their own tables called tblAirline and tblNonAirline.

        Therefore, if I wanted to store flight information for a participant, I need to store participant ID in the foreign key field in tblAirline.

        I’m completely new to VBA. Can you please help me figure out the syntax for using OpenArgs? The line I created only comes up with a Null value.

        Thanks.

        • #524743

          I think you are trying to do something with record sets that could be achieved with combo boxes.

          All you need is your

          • #524744

            Charlotte and Rupert:

            Thanks for your suggestions — I just realized that I could have easily used the Tab Control to switch between Airline and NonAirline forms and setting up Parent/Child relationship between Primary Key and Foreign Key. This was simple solution that I didn’t think of earlier! grin.

    Viewing 0 reply threads
    Reply To: Bookmarking a record for use in another form

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: