Results 1 to 2 of 2
  1. #1
    Wagon is offline Novice
    Windows 7 64bit Access 2002
    Join Date
    Dec 2015
    Posts
    11

    Dcount on variable Columns

    Good Morning Guys,



    What i am trying to do is a DCount on a table but instead of the criteria changing I want the column that is looks for the criteria to be variable based on a combo box

    What I currently have is

    =DCount("[Number]","[Products]","Cherry = True")

    It is the column in red above that I wish to be based from the combo box drop down on my form which is combo1

    If anyone can help it would be much appreciated, I'm still learning forms in access

    Thank you

    Regards

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    you can try

    =DCount("[Number]","[Products]","[" & combo1 & "] = True")

    where combo1 is the name of your combo control (lousy naming convention by the way - rename with something meaningful)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 02-13-2016, 12:40 PM
  2. Using DCount, how to use a variable as the criteria
    By crowegreg in forum Programming
    Replies: 2
    Last Post: 02-17-2015, 05:18 PM
  3. Replies: 0
    Last Post: 08-10-2011, 11:59 AM
  4. VBA DCount() with variable field name
    By drh in forum Programming
    Replies: 2
    Last Post: 07-13-2010, 12:36 AM
  5. Refering to variable form names inside a variable
    By redpetfran in forum Programming
    Replies: 2
    Last Post: 05-21-2010, 01:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums