Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2004
    Posts
    5

    Question Unanswered: Navigating in Subforms

    Hello,

    I have a button which opens a form with one subform when clicked. Both, form and subform, show some data from my DB. Now I want to set the cursor (the selected row) to a specific row. For the form I use "DoCmd.GotoRecord(...)" which works fine. When accessing the subform, however, the "GotoRecord" method will not work. By accessing the subform directly (with Forms.MyForm.MySubform) I can get the current position, but not set it.
    I'm sure that this is a quite simple problem with an obvious solution, but I spent hours on it without finding a solution. I would be very pleased by every hint.

    Felix

  2. #2
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    Would it not be possibly to set a button on the subform that will find the specific row?

    I'm not quite sure what you mean by the selected row or specific row?

  3. #3
    Join Date
    Aug 2004
    Posts
    5
    Maybe I should me more detailled... The subform I use was created with the design assitent and looks a bit like a datagrid, which means that the user can see every row and column of a table (the datasource). The user can also select a row by clicking on it, and there's a cursor which shows the selected row. When the subform is opened, always the first row is selected. Now the only thing I want to do is automatically select another row in the opening step, without changing the contents of the table (just an UI issue).
    English is not my first language, so please write if something is still not clear.

  4. #4
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1

    Selecting record on subform

    Hi

    I believe you wnant someting like this

    [subFornControlName].Form.RecordsetClone.FindFirst "Id = " & [ID]
    [subFormControlName].Form.Bookmark = [subFormControlName].Form.RecordsetClone.Bookmark

    [ID] is the field OR Control OR variable holding the id of the record you want to 'GoTo'

    not also this code would be in the main form hildond the sub form. If the code is rum from another open form then add a referance to the front ie

    Forms![MainformName]![subFornControlName].Form.RecordsetClone.FindFirst "Id = " & [ID]

    You have to access the FORM object of the subFormControl to geto the controls and properies of the subform itself.

    HTH

    MTB

  5. #5
    Join Date
    Aug 2004
    Posts
    5

    Smile

    That's what I've been searching for! Thanks a lot for your help.

    Felix

Posting Permissions

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