a_migdal
asked on
criteria
when creating a query critieror using the following
Expr1: Year([date])
[Enter year:]
this works great but how can i make the popup box that appears to type the year into already have text in ie the currant year i know that
Year(Date())
displays all my records of the currant year. A combination of the 2 would be great. This would mean that i do not have to type in the currant year every time, but if i wanted to view the previous years records i ccould do that esily
cheers migs
Expr1: Year([date])
[Enter year:]
this works great but how can i make the popup box that appears to type the year into already have text in ie the currant year i know that
Year(Date())
displays all my records of the currant year. A combination of the 2 would be great. This would mean that i do not have to type in the currant year every time, but if i wanted to view the previous years records i ccould do that esily
cheers migs
You could go a step further with with the pop-up form and instead of using a text box you could use a combo box that would have as its RowSource something like the following:
SELECT Year([DateInTable]) AS Expr1
FROM tblYourTable
GROUP BY Year([DateInTable])
ORDER BY Year([DateInTable]) DESC;
The default value for the combo could be Year(Date()) and the criteria in your query could then reference the combobox on the pop-up form.
In the OnLoad event procedure of the popup form enter the following:
me![ComboBoxName].setfocus
me![ComboBoxName].dropdown
This way all years that are possibile in your table are in the drop-down of the combobox. They are sorted Descending so that the top one is the current one and you will only have to pick the appropriate year that you wish to run. No typing.
Bob Scriver
SELECT Year([DateInTable]) AS Expr1
FROM tblYourTable
GROUP BY Year([DateInTable])
ORDER BY Year([DateInTable]) DESC;
The default value for the combo could be Year(Date()) and the criteria in your query could then reference the combobox on the pop-up form.
In the OnLoad event procedure of the popup form enter the following:
me![ComboBoxName].setfocus
me![ComboBoxName].dropdown
This way all years that are possibile in your table are in the drop-down of the combobox. They are sorted Descending so that the top one is the current one and you will only have to pick the appropriate year that you wish to run. No typing.
Bob Scriver
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
for a_migdal
No comment has been added for the last two months.
So it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- Answered by: kiddiec
Please leave any comments here within the
next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
Nic;o)
No comment has been added for the last two months.
So it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- Answered by: kiddiec
Please leave any comments here within the
next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
Nic;o)
Thanks for your help, Nic;o)
Finalized by Moondancer - EE Moderator
Finalized by Moondancer - EE Moderator
The query will use the value on the form. You can change it or leave it as is. Place a button on the form to execute your query.