Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Royal Oak, Michigan, USA
    Posts
    255
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SubForm Search (v2000)

    I have a single-form with a company name and a main contact for each company. I have a linked subform with a list of additional contact names. If I search for a main contact name, I go to the record easily. If I search for an additional contact name it can't find the name because the subform references the current record. I understand why it can't find the additional contact...I am just wondering the best way around this. How can I search the subform for additional contact names and go to the correct company?
    Thanks!!

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

    Re: SubForm Search (v2000)

    Maybe you could put a combobox on the main form that queries the contacts and once you have the contact then set a bookmark on the main form based upon the Company name.

  3. #3
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Royal Oak, Michigan, USA
    Posts
    255
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SubForm Search (v2000)

    I tried this:
    Private Sub txtContName_AfterUpdate()
    'Find the record that matches the control.
    Forms![frmSwitchboard]![Customer Data].RecordsetClone.Findfirst "[txtCustID] = " & Me.txtCoID
    Forms![frmSwitchboard]![Customer Data].Bookmark = Forms![frmSwitchboard]![Customer Data].RecordsetClone.Bookmark
    End Sub
    where 'Customer Data' is the name of a tab and 'txtContName' is a control on the subform. However, it doesn't move to the desired record.

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

    Re: SubForm Search (v2000)

    <hr>where 'Customer Data' is the name of a tab <hr>
    You don't reference tab controls at all in expressions like this. The syntax to use in addressing a subform would be:

    Forms!MyForm!SubformControlName.Form!ControlOnSubf orm

    If the code is being run inside the parent form, you can use the Me reference like this:

    Me!SubformControlName.Form.RecordsetClone
    Me!SubformControlName!ControlOnSubform


    Understand that the subform control name can be different from the name of the actual subform bound to it, and you have to tell Access whether you're talking about the subform control or the subform itself (SubformControlName.Form). When you need a recordsetclone, you must specify the .Form in order to let Access know what you mean, since the subform *control* doesn't have a recordset, let alone a recordsetclone.
    Charlotte

Posting Permissions

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