Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jun 2003
    Camp Lejeune, North Carolina, USA
    Thanked 0 Times in 0 Posts

    Datatbase Query relation to Report Form

    I have a database that tracks attendees to a workshop. There are many yes and no fields that require to be counted. I have a query that pulls that data and a report form that uses dcount to seperate criteria. This is the dcount =DCount("*","TAP stats Loc Query","[TAP stats Loc Query]![RETIREE]='N' AND [TAP stats Loc Query]![SERVICE]='USMC' AND [TAP stats Loc Query]![# days before TAP] <90 AND [TAP stats Loc Query]![SPOUSE]='N' AND [TAP stats Loc Query]![RESERVE]='N' AND [TAP stats Loc Query]![SEP_CAT]='VOL'"). This works fine now but as soon as I put a between statement in the query to seperate a start and stop date and location I get an #error in the counting field in th report form. I have been using between statement Between [Enter Starting Date yyyy-mm-dd] And [Enter Ending Date yyyy-mm-dd] for the start date field and [Enter Location] in the location field of query. The yes and no are set up a text fields so they can be conted in the dcount as y or no. Thanks for your help
    Last edited by lockwoodbf; 2011-10-20 at 11:04. Reason: Additional information

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Mt Macedon, Victoria, Australia
    Thanked 45 Times in 44 Posts
    You can't have a prompt for start and end dates when you use a query for DCounts. Instead the query needs to take those dates from text boxes on a form, that would need to be open when you run the report.

    Something like:

    Between [Forms]![frmLaunchReport]![txtStartDate] and [Forms]![frmLaunchReport]![txtEndDate]

    where the form is called frmlaunchReport and txtStartDate and txtEnddate are two text boxes on the form formatted as dates.

Posting Permissions

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