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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Parameter Query?



 
 
Thread Tools Display Modes
  #11  
Old July 21st, 2008, 05:21 PM posted to microsoft.public.access.queries
Hank
external usenet poster
 
Posts: 51
Default Parameter Query?

Thanks for all your help Bob.

I deleted my query and started over with this:
SELECT Birthdaysqry.KnownBy, Birthdaysqry.LastName, Birthdaysqry.Birthdate,
Birthdaysqry.Month, Birthdaysqry.Day
FROM Birthdaysqry
WHERE (((Birthdaysqry.Month)=[Enter two digit month:]));

Could not get it to work when I put PARAMETERS at the top. I Have [Enter
two digit month:] as Criteria. And it works!
Might be some things I am missing that will make it work better. I like the
idea of only having to enter a single digit month but for now it's OK.
Thanks again
Hank

Thanks again.

"Bob Barrows [MVP]" wrote in message
...
Hank wrote:
Sorry, I don't understand.

I replaced "PARAMETERS[Month] Short;" , with "PARAMETERS[Enter Month]
Text (255);" in the SQL view but I still get blank results. ( I dont
know what Text(255); is telling me.)
I tried entering NOV and 11 for November - same results.
If I remove the Crieteria "Enter Month:" in the design view, I am
still prompted to enter a month. Then, no mater what month I enter
(Nov or 11), the results is every birthday in every month.
What did I do wrong?

"Bob Barrows [MVP]" wrote in message
...
Hank wrote:
SQL View:
PARAMETERS [Month] Short;

This is wrong. It should say:

PARAMETERS [Enter Month] Text (255);



Instead of requiring your users to enter the leading zeroes, you might try
using the Month() function instead:

PARAMETERS [Enter Month] Short;
SELECT StudentsTbl.StudentID, StudentsTbl.KnownBy, StudentsTbl.LastName,
StudentsTbl.Birthdate,
Month([Birthdate]) AS [Month],
Format([Birthdate],"dd") AS [Day]
FROM StudentsTbl
WHERE Month([Birthdate])=[Enter Month:]
ORDER BY StudentsTbl.Birthdate, Format([Birthdate],"mm");

Now all the user has to enter for June dates is 6, instead of 06.

And I just saw what you were doing wrong: you had
WHERE (((Format([Birthdate],"mm"))="Enter Month:"))

And you should have had:
WHERE (((Format([Birthdate],"mm"))=[Enter Month:]))








--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"



 




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 08:59 AM.


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