Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Feb 2003
    Location
    England
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Query Criteria from Form (Access 2000)

    I am trying to create a query which takes the criteria from a textbox in a form, which itself has been filtered.

    I have a button on the form with runs the query, which should display all dates for ther person shown in the textbox on the form.

    I have tried useing:
    =[textbox]

    and:
    [form]!formname]![textbox]

    and:

    [me]![textbox]

    where formname is the name of the form and textbox is the name of the textbox.

    but it when I run the query it just comes up asking what i want [form]!formname]![textbox] contains.

    How do you get it so that the query will use the textbox on the form as the criteria?

  2. #2
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Query Criteria from Form (Access 2000)

    you are also missing a left-hand square bracket

    [forms]!<font color=red>[</font color=red>formname]![textbox]
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

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

    Re: Query Criteria from Form (Access 2000)

    Oops, thanks for pointing that out. The <img src=/S/devil.gif border=0 alt=devil width=15 height=15> is always in the details.

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

    Re: Query Criteria from Form (Access 2000)

    You almost got it right. The correct expression is

    [forms]![formname]![textbox]

    In other words, use Forms instead of Form, and there was a missing left bracket before formname.

    Added: Thanks to SteveH for pointing out the missing bracket! I overlooked that one.

Posting Permissions

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