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
46 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
7 Comments
 
LVL 7

Accepted Solution

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

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 17

Expert Comment

by:Pawan Kumar Khowal
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 17

Expert Comment

by:Pawan Kumar Khowal
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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 …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now