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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Searching for records between two dates



 
 
Thread Tools Display Modes
  #1  
Old August 19th, 2004, 01:35 AM
Nick in Tokyo
external usenet poster
 
Posts: n/a
Default Searching for records between two dates

Ok, I have two text boxes two enter short dates into, a button click opens a
form which displays the results of a query that does the date comparison.

When I click the button access then asks me to put the dates in, even though
they're already in the textboxes. If I enter the dates into the prompts then
the results are correct. What I'm, wondering is why the query can't seem to
read the values from the form directly. Is there something extra that needs
to be done with dates?
  #2  
Old August 19th, 2004, 01:54 AM
Douglas J. Steele
external usenet poster
 
Posts: n/a
Default

What have you got in the query as parameters? If it's Forms!name of
form!name of control (where name of form and name of control are
replaced with the appropriate values), it should work.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Nick in Tokyo" wrote in message
...
Ok, I have two text boxes two enter short dates into, a button click opens

a
form which displays the results of a query that does the date comparison.

When I click the button access then asks me to put the dates in, even

though
they're already in the textboxes. If I enter the dates into the prompts

then
the results are correct. What I'm, wondering is why the query can't seem

to
read the values from the form directly. Is there something extra that

needs
to be done with dates?



  #3  
Old August 19th, 2004, 02:23 AM
Nick in Tokyo
external usenet poster
 
Posts: n/a
Default

it's
=[Forms]![License_Search_Menu]![DateFrom] And

=[Forms]![License_Search_Menu]![DateTo]

"Douglas J. Steele" wrote:

What have you got in the query as parameters? If it's Forms!name of
form!name of control (where name of form and name of control are
replaced with the appropriate values), it should work.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Nick in Tokyo" wrote in message
...
Ok, I have two text boxes two enter short dates into, a button click opens

a
form which displays the results of a query that does the date comparison.

When I click the button access then asks me to put the dates in, even

though
they're already in the textboxes. If I enter the dates into the prompts

then
the results are correct. What I'm, wondering is why the query can't seem

to
read the values from the form directly. Is there something extra that

needs
to be done with dates?




  #4  
Old August 19th, 2004, 02:37 AM
Nick in Tokyo
external usenet poster
 
Posts: n/a
Default

Actually, it's kind of working now. Without my changing it. Now, if I don't
enter anything into the prompts, it brings up the correct results. But it's
still prompting me. Can I get rid of the prompts?

"Douglas J. Steele" wrote:

What have you got in the query as parameters? If it's Forms!name of
form!name of control (where name of form and name of control are
replaced with the appropriate values), it should work.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Nick in Tokyo" wrote in message
...
Ok, I have two text boxes two enter short dates into, a button click opens

a
form which displays the results of a query that does the date comparison.

When I click the button access then asks me to put the dates in, even

though
they're already in the textboxes. If I enter the dates into the prompts

then
the results are correct. What I'm, wondering is why the query can't seem

to
read the values from the form directly. Is there something extra that

needs
to be done with dates?




  #5  
Old August 19th, 2004, 03:44 AM
Douglas J. Steele
external usenet poster
 
Posts: n/a
Default

Is it possible that you've got a typo somewhere in the form?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Nick in Tokyo" wrote in message
...
Actually, it's kind of working now. Without my changing it. Now, if I

don't
enter anything into the prompts, it brings up the correct results. But

it's
still prompting me. Can I get rid of the prompts?

"Douglas J. Steele" wrote:

What have you got in the query as parameters? If it's Forms!name of
form!name of control (where name of form and name of control are
replaced with the appropriate values), it should work.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Nick in Tokyo" wrote in message
...
Ok, I have two text boxes two enter short dates into, a button click

opens
a
form which displays the results of a query that does the date

comparison.

When I click the button access then asks me to put the dates in, even

though
they're already in the textboxes. If I enter the dates into the

prompts
then
the results are correct. What I'm, wondering is why the query can't

seem
to
read the values from the form directly. Is there something extra that

needs
to be done with dates?






  #6  
Old August 19th, 2004, 06:54 AM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Wed, 18 Aug 2004 18:37:02 -0700, "Nick in Tokyo"
wrote:

Actually, it's kind of working now. Without my changing it. Now, if I don't
enter anything into the prompts, it brings up the correct results. But it's
still prompting me. Can I get rid of the prompts?


A couple of possibilities:

- Is the form open when you try to run the query? It should be; the
query won't open the form for you.
- Might you have misspelled the name of the form in the criterion?
- It may be worthwhile to put the two parameters into the Query's
Parameters collection: right mouseclick the grey background of the
tables in the query grid, select Parameters, and copy and paste the
criteria (they must match EXACTLY) into the Parameters column. Specify
Date/Time in the second column.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
  #7  
Old August 19th, 2004, 09:01 AM
Nick in Tokyo
external usenet poster
 
Posts: n/a
Default

Thankyou, I had a typo in my parameter specs. Fixed now. Thanks very much for
your help. Now if you could tell me how to get a cancel button going (above)
then I'll love you forever.

"John Vinson" wrote:

On Wed, 18 Aug 2004 18:37:02 -0700, "Nick in Tokyo"
wrote:

Actually, it's kind of working now. Without my changing it. Now, if I don't
enter anything into the prompts, it brings up the correct results. But it's
still prompting me. Can I get rid of the prompts?


A couple of possibilities:

- Is the form open when you try to run the query? It should be; the
query won't open the form for you.
- Might you have misspelled the name of the form in the criterion?
- It may be worthwhile to put the two parameters into the Query's
Parameters collection: right mouseclick the grey background of the
tables in the query grid, select Parameters, and copy and paste the
criteria (they must match EXACTLY) into the Parameters column. Specify
Date/Time in the second column.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public

  #8  
Old August 20th, 2004, 07:15 AM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Thu, 19 Aug 2004 01:01:01 -0700, "Nick in Tokyo"
wrote:

Thankyou, I had a typo in my parameter specs. Fixed now. Thanks very much for
your help. Now if you could tell me how to get a cancel button going (above)
then I'll love you forever.


I'm not altogether certain that your offered incentive is the best
choice but...

a Cancel button with code such as

Private Sub cmdCancel_Click()
Dim iAns As Integer
iAns = MsgBox("This will cancel the entry and erase your input. OK?" _
, vbYesNo)
If iAns = vbYes Then
Me.Undo
End If
End Sub

will let the user cancel a record being added (of course, hitting
Esc twice will do the same).

Since I couldn't find a post in this thread involving a cancel button,
I'm not sure this is what you want!

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart possible of dates vs. pounds? GBL General Discussion 3 July 6th, 2004 03:56 AM
CountIf function + dates patricia Worksheet Functions 3 May 24th, 2004 11:27 PM
Sumproduct search between Dates Robert Christie Worksheet Functions 5 May 22nd, 2004 03:09 PM
Charting woes with hidden dates dustin pockets Charts and Charting 4 April 15th, 2004 04:20 AM
subtracting dates to give a whole number Lasitter Worksheet Functions 2 October 1st, 2003 09:14 AM


All times are GMT +1. The time now is 04:05 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.