Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Nov 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    aggregate function to textbox (access 2003)

    Trying assign to Control Source of text box aggregate function that counts number of records with certain criteria- the query works good, but text box doesn't want to accept the value and gives me #Name ( I have tried to assign value using Build feature)

    Thank you
    Alex

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: aggregate function to textbox (access 2003)

    I am not sure if this is any help, but...

    I find that if I create a form with a control bound to a field in the underlying table/query, then change the control source to some calculated value (that includes the original field) I often get the #Name error.

    The problem is that initially both the Control Source and the Name of the control are set to the field name. To fix it I need to change the Name of the control so it is different from the field name. Typically I put a txt in front of it (if it is a text box).
    Regards
    John



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

    Re: aggregate function to textbox (access 2003)

    Welcome to Woody's Loung1

    If John's suggestion doesn't solve your problem, you might try setting the control source of the text box to a formula like this:

    =DCount("*","QueryName")

    to display the count of all records in the query QueryName, or

    =DCount("*","QueryName","SomeField = 12")

    to display the count of records in QueryName for which the field SomeField is equal to 12.

Posting Permissions

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