Solved

I would like the syntax to have an user enter a Store ID or Date in order to run a report?

Posted on 2016-10-14
7
64 Views
Last Modified: 2016-11-19
I have a report of a form. I want to user to select a Store ID or a date to call up the report. I was able to set a date range to enter a query, which works well. The syntax I used was this. Between [beginning Date?] And [Ending Date?] I am looking for the correct syntax to make this work. I know I can't use "Between" because it's for a range. Do you know the syntax???
Thanks
Earl
0
Comment
Question by:Earl Wolf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 7

Accepted Solution

by:
COACHMAN99 earned 250 total points (awarded by participants)
ID: 41843836
use the Datediff command
0
 
LVL 37

Assisted Solution

by:PatHartman
PatHartman earned 250 total points (awarded by participants)
ID: 41843837
You would use the = sign.

A better method of passing arguments to a report is to enter them on the form that runs the report.  That way you can validate the arguments first and you will not be prompted multiple times to enter them as you are if you preview first and then print.

Some Examples


Where SomeField = Forms!yourform!SomeField

Where SomeDate Between Forms!yourform!startDate And Forms!yourform!EndDate

Where SomeField = Forms!yourform!SomeField OR (SomeDate Between Forms!yourform!startDate And Forms!yourform!EndDate)

Where SomeField = Forms!yourform!SomeField AND  (SomeDate Between Forms!yourform!startDate And Forms!yourform!EndDate)
0
 
LVL 7

Assisted Solution

by:COACHMAN99
COACHMAN99 earned 250 total points (awarded by participants)
ID: 41843843
or where datediff("d", [beginning Date], FindDate) > 0 and datediff("d", [Ending Date] , Finddate) < 0

I removed the "?" and used Finddate as the comparator.

sometimes between gives false results if the dates are on the same day but have different times
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 28

Expert Comment

by:Pawan Kumar
ID: 41844592
Try..

WHERE ( [beginning Date] >= FindDate AND FindDate <= [Ending Date] )
0
 
LVL 9
ID: 41845380
I recommend having the report call a form (I know, it seems backwards at first - trust me) to prompt for selection criteria and build a Where clause.  See our free download Report Selection Techniques at http://www.jstreettech.com/downloads.  We use this technique for all our Access projects.

Cheers,
Armen
0
 
LVL 28

Expert Comment

by:Pawan Kumar
ID: 41866437
@Author - A feedback will be appreciated.

Thank you!
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 41894049
All valid comment
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question