Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243

    Unanswered: go to specific record on a subform

    I have a form containing 2 (continuous) subforms (sub1 and sub2)
    Each subform is based on a table (table1 and table2).
    When I doubleclick a record on sub1, the corresponding record is deleted in table1 (and will disappear on sub1) and added to table2 (and will appear on sub2).

    A similar situation will happen when doubleclicking a record on sub2.

    Now when doubleclicking a record (let's say recordnumber 5) it will disappear from the sub and my first record on that sub is selected.
    What I want is that the record following on the deleted record is selected.

    I tried using :
    Code:
    DoCmd.GoToRecord , Me.Name, acGoTo, 5
    This works fine when the sub is opened by itself, but not when included in another form.
    I always get an error that the specified form is not opened.

    How can I solve this?

    Thanks.

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465

    Re: go to specific record on a subform

    Originally posted by artemide
    I have a form containing 2 (continuous) subforms (sub1 and sub2)
    Each subform is based on a table (table1 and table2).
    When I doubleclick a record on sub1, the corresponding record is deleted in table1 (and will disappear on sub1) and added to table2 (and will appear on sub2).

    A similar situation will happen when doubleclicking a record on sub2.

    Now when doubleclicking a record (let's say recordnumber 5) it will disappear from the sub and my first record on that sub is selected.
    What I want is that the record following on the deleted record is selected.

    I tried using :
    Code:
    DoCmd.GoToRecord , Me.Name, acGoTo, 5
    This works fine when the sub is opened by itself, but not when included in another form.
    I always get an error that the specified form is not opened.

    How can I solve this?

    Thanks.
    I thing that some is wrong in the event delete of the subform because when you delete a record in the subform automatically pass to the next record, my be there is a requery in that event ......
    Saludos
    Norberto

  3. #3
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243

    Re: go to specific record on a subform

    Originally posted by Norberto
    I thing that some is wrong in the event delete of the subform because when you delete a record in the subform automatically pass to the next record, my be there is a requery in that event ......
    I have a subform showing all the records of a table.
    Doubleclicking a record will delete that record from the table.
    And because it no longer belongs to the table I don't want it to be displayed in the subform. So I did a requery to update my subform.

    Is there a way to keep my method and add some code to go to the record following the deleted one (I know the recordnumber to go to), or do I have to use another approach?

    Thanks

  4. #4
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465

    Re: go to specific record on a subform

    Originally posted by artemide
    I have a subform showing all the records of a table.
    Doubleclicking a record will delete that record from the table.
    And because it no longer belongs to the table I don't want it to be displayed in the subform. So I did a requery to update my subform.

    Is there a way to keep my method and add some code to go to the record following the deleted one (I know the recordnumber to go to), or do I have to use another approach?

    Thanks
    Ok....
    Do this:
    After make the Requery and before the DoCmd.GoToRecord , Me.Name, acGoTo, ...... insert this sentece:
    Forms![MainForm]![Subform].SetFocus.
    This is for have the focus in the subform before go to the record.
    This must be work.
    I hope this help you.
    Saludos
    Norberto

Posting Permissions

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