Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What does it mean - can't find form? (XP,2000)

    I have a statement in the afterupdate property that says

    Private Sub Searchbox_AfterUpdate()
    Forms!Prospect_lookup.Requery
    End Sub

    My intention is to force a subform (which displays search results in a datasheet) to requery in order to display search results based on value of Searchbox. I get a msg saying Access cannot find the form "PROSPECT_LOOKUP" referenced in VB code.

    I KNOW it is spelled correctly so what am I missing? the form Prospect_Lookup is a subform of Form_Query_input, The serchbox is an unbound textbox control.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: What does it mean - can't find form? (XP,2000)

    The Forms collection only contains forms opened as a "main form". A subform is not part of the Forms collection. Use this instead:

    If Prospect_lookup is a subform of the active form, use Me!Prospect_lookup.Form.Requery. If Form_Query_input is not the active form, use Forms!Form_Query_input!Prospect_lookup.Form.Requer y.

    Note: you must use the name of the subform as a control on the main form; this is not necessarily the same as the name it has in the database window.

  3. #3
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: What does it mean - can't find form? (XP,2000)

    That made some difference. Now, instead of cannot find form, it says cannot find field. The active form is "Query input" and "prospect lookup" is the subform. I think the subform control has the same name as the form in the database window. I added the _ to replace the space.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: What does it mean - can't find form? (XP,2000)

    Try Me![Prospect lookup].Form.Requery then.

  5. #5
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: What does it mean - can't find form? (XP,2000)

    That works. Thank you. Why is is that sometimes brackets are needed and othertimes they're not?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: What does it mean - can't find form? (XP,2000)

    If the name of a field, control, form or report contains spaces, you must put brackets around it to avoid confusion. The same holds for some other characters that could cause confusion, such as / and - (they would be interpreted as division and subtraction, respectively, if there were no brackets around the name. For "ordinary" names the brackets are not required, although it doesn't hurt to use them.

Posting Permissions

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