help (1 Viewer)

murray83

Games Collector
Local time
Today, 04:17
Joined
Mar 31, 2017
Messages
729
Help with query criteria

Firstly Good Morning, well is in the UK at the moment and I need/would like a little assistance.

I have the following as the criteria for my query

Code:
Between [From Date DD/MM/YY] And [To Date DD/MM/YY]

And want to use the input of this, to run another query, which has the same criteria, other wise they have to enter the dates 4 times; two From Date & 2 To Date.

another option i was thinking was putting the dates in a table, then have a text box on my form and have them dlookup and then have them (the boxes) be the criteria for the second query

but have searched ol Google and here but not found anything for between dates

any help would be gratefully appreciated, cheers
 
Last edited:

June7

AWF VIP
Local time
Yesterday, 19:17
Joined
Mar 9, 2014
Messages
5,471
What do you mean by 'dates in a table' and 'dlookup' - why would that be a solution?

I never use dynamic parameters in query but if you really want to then should reference controls on form instead of having popup input prompt.

Review http://allenbrowne.com/ser-62.html
 

essaytee

Need a good one-liner.
Local time
Today, 13:17
Joined
Oct 20, 2008
Messages
512
Quick question, for your first query, how are the dates (from & to) retrieved or entered into your query?

Edit: What June said as well.
 

murray83

Games Collector
Local time
Today, 04:17
Joined
Mar 31, 2017
Messages
729
data is inputted through a prompt to the user as shown in the attached

  1. Click On Number 1
  2. Then enter From Date in 2
  3. Then enter To Date at 3

and then i would like this to either be put in a text box, put on a table which i can then dlookup, or have this inputted criteria run the second query using the IN Select which have seen and used in the past but not for between dates

Code:
In (SELECT [stuff here] FROM [tbl or query here] )
 

Attachments

  • here.jpg
    here.jpg
    22.9 KB · Views: 65
  • then.jpg
    then.jpg
    19.5 KB · Views: 57

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 23:17
Joined
May 21, 2018
Messages
8,529
That format would not work anyways. SQL uses mm/dd/yyyy format regardless of regional settings and any formatting on the field.
 

Gasman

Enthusiastic Amateur
Local time
Today, 04:17
Joined
Sep 21, 2011
Messages
14,299
That format would not work anyways. SQL uses mm/dd/yyyy format regardless of regional settings and any formatting on the field.

That format appears to work from simple input prompts.? even when not specifying the century.
 

essaytee

Need a good one-liner.
Local time
Today, 13:17
Joined
Oct 20, 2008
Messages
512
Create a form, create two text boxes, name them accordingly (txtDateStart and txtDateEnd - or whatever naming convention you prefer).

In your query criteria cell enter references to the form, similar to:
Code:
Between [Forms]![frm_DateQuery]![txtDateStart] And [Forms]![frm_DateQuery]![txtDateEnd]
Sample image:


First of all, get this to work and then we can fine tune for US date style if required.

You will also note that for this query to run, the form must be open, if not, you will be presented with input boxes.
 

Attachments

  • 2019-04-24_22-33-19.jpg
    2019-04-24_22-33-19.jpg
    35.8 KB · Views: 109

Users who are viewing this thread

Top Bottom