A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

date query criteria prompt



 
 
Thread Tools Display Modes
  #1  
Old May 9th, 2010, 05:41 PM posted to microsoft.public.access
Åžehla
external usenet poster
 
Posts: 1
Default date query criteria prompt


"tina" , iletisinde şunu yazdı,
...
hi
I would like to add a prompt to a query allowing user to enter month and
year desired and show all records where matches criteria
the date is in format dd/mm/yy
so if users enters 04/10 at prompt they would get all data for april 2010
or do I need to have start date and stop date
thanks
tina


  #2  
Old May 10th, 2010, 03:51 PM posted to microsoft.public.access
Tina
external usenet poster
 
Posts: 350
Default date query criteria prompt

hi
I would like to add a prompt to a query allowing user to enter month and
year desired and show all records where matches criteria
the date is in format dd/mm/yy
so if users enters 04/10 at prompt they would get all data for april 2010
or do I need to have start date and stop date
thanks
tina
  #3  
Old May 10th, 2010, 04:03 PM posted to microsoft.public.access
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default date query criteria prompt

Realistically, you need a start date and stop date although in your case you
should be able to derive the stop date from the start date. If you're going
to have them input a single value representing mm/yy, you should be able to
use

BETWEEN DateSerial(CInt(Mid([NameOfPrompt], InStr([NameOfPrompt], "/") +
1)), CInt(Left([NameOfPrompt], InStr([NameOfPrompt], "/") - 1)), 1) AND
DateSerial(CInt(Mid([NameOfPrompt], InStr([NameOfPrompt], "/") + 1)),
CInt(Left([NameOfPrompt], InStr([NameOfPrompt], "/") - 1)) + 1, 0)

Just to clear up a misconception, though, the dates are NOT stored in
dd/mm/yy format. Dates in Access are stored as 8 byte floating point
numbers, where the integer portion represents the date as the number of days
relative to 30 Dec, 1899 and the decimal portion represents the time as a
fraction of a day. You might find it useful to read what Allen Browne has at
http://www.allenbrowne.com/ser-36.html or what I wrote in my September, 2003
"Access Answers" column in Pinnacle Publication's "Smart Access" (you can
read it for free at http://www.vb123.com/kb/200309_ds_aa.htm )

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"tina" wrote in message
...
hi
I would like to add a prompt to a query allowing user to enter month and
year desired and show all records where matches criteria
the date is in format dd/mm/yy
so if users enters 04/10 at prompt they would get all data for april 2010
or do I need to have start date and stop date
thanks
tina



  #4  
Old May 10th, 2010, 04:07 PM posted to microsoft.public.access
ghetto_banjo
external usenet poster
 
Posts: 325
Default date query criteria prompt

You can modify the WHERE clause of the SQL statement to include
something like this:


WHERE Format([datefield], "mm/yy") = [Please Enter Month/Year]




Or similarly in the Query Design view you add a field like:

myeah: Format([datefield], "mm/yy")


With criteria: [Please Enter Month/Year])


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.