Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Seattle, Washington, USA
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Bookmarking a record for use in another form

    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

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Bookmarking a record for use in another form

    What are you trying to do with this line?
    <hr>' Locate the record for the selected participant.
    rst.FindFirst "ParticipantID = "<hr>
    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.
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Seattle, Washington, USA
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarking a record for use in another form

    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.

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarking a record for use in another form

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

    All you need is your

  5. #5
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Seattle, Washington, USA
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarking a record for use in another form

    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.

Posting Permissions

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