|  | Combo Box feeding a query |  | |
| | | Bunky |  |
| Posted: Thu Sep 04, 2008 10:58 am Post subject: Combo Box feeding a query |  |
Good Day to All!
I have a form with a combo box on it that is sending dates to a query. The Combo Box has a source of Distinct dates from a table. The idea is when the user selects the 1st (most current date) it will use this date throughout all the queries in the series for the report. This is working fine. Now, I want to expand this like this: I want the 2nd and the 3rd and the 4th most current dates as well. I cannot use DateAdd because the dates a not a set number of days apart. How can I reference the dates not selected? I have limited the number of dates shown to 4 so regardless what date is chosen, I want the date chosen and the 3 that preceeds it.
My code to select the current date from the form is [forms]![UGPRform]![Combo1]
Thank you in advance for your assistance. |
| |
| | | Arvin Meyer [MVP] |  |
| Posted: Thu Sep 04, 2008 11:18 am Post subject: Re: Combo Box feeding a query |  |
| |  | |
You may have some trouble from the combo, because it only can provide a single value, but you have to other choices:
1. You can manually choose from a multi-select list box or: 2. Use the same rowsource as the combo in another query with the TOP predicate as :
SELECT TOP 4 DateField, ID FROM YourTable ORDER BY DateField Desc; -- Arvin Meyer, MCP, MVP LINK LINK LINK
"Bunky" <Bunky@discussions.microsoft.com> wrote in message news:4D283AAB-4D96-4D59-8B59-AAC69CF43CEF@microsoft.com...
| Quote: | Good Day to All!
I have a form with a combo box on it that is sending dates to a query. The Combo Box has a source of Distinct dates from a table. The idea is when the user selects the 1st (most current date) it will use this date throughout all the queries in the series for the report. This is working fine. Now, I want to expand this like this: I want the 2nd and the 3rd and the 4th most current dates as well. I cannot use DateAdd because the dates a not a set number of days apart. How can I reference the dates not selected? I have limited the number of dates shown to 4 so regardless what date is chosen, I want the date chosen and the 3 that preceeds it.
My code to select the current date from the form is [forms]![UGPRform]![Combo1]
Thank you in advance for your assistance.
|
|
| |
| | | Bunky |  |
| Posted: Thu Sep 04, 2008 3:56 pm Post subject: Re: Combo Box feeding a query |  |
| |  | |
Arvin,
If I go for option 2, how can I tell the query to get the 2nd date or later? Is that possible? In COBOL (Yes, I am a dinosaur), you could access whatever level of a table you wanted by simply entering the name of the element and -1 for the first one down or -2 for the second one.
Thanks a bunch for your assistance!
"Arvin Meyer [MVP]" wrote:
| Quote: | You may have some trouble from the combo, because it only can provide a single value, but you have to other choices:
1. You can manually choose from a multi-select list box or: 2. Use the same rowsource as the combo in another query with the TOP predicate as :
SELECT TOP 4 DateField, ID FROM YourTable ORDER BY DateField Desc; -- Arvin Meyer, MCP, MVP LINK LINK LINK
"Bunky" <Bunky@discussions.microsoft.com> wrote in message news:4D283AAB-4D96-4D59-8B59-AAC69CF43CEF@microsoft.com... Good Day to All!
I have a form with a combo box on it that is sending dates to a query. The Combo Box has a source of Distinct dates from a table. The idea is when the user selects the 1st (most current date) it will use this date throughout all the queries in the series for the report. This is working fine. Now, I want to expand this like this: I want the 2nd and the 3rd and the 4th most current dates as well. I cannot use DateAdd because the dates a not a set number of days apart. How can I reference the dates not selected? I have limited the number of dates shown to 4 so regardless what date is chosen, I want the date chosen and the 3 that preceeds it.
My code to select the current date from the form is [forms]![UGPRform]![Combo1]
Thank you in advance for your assistance.
|
|
| |
| | | Arvin Meyer [MVP] |  |
| Posted: Fri Sep 05, 2008 4:32 pm Post subject: Re: Combo Box feeding a query |  |
| |  | |
COBOL databases, if I can remember back that far <lol> where almost always hierarchal, not relational. Access is an ISAM (Indexed Sequential Access Method) database. There is no predetermined order, which is why I had to create the Order By clause. -- Arvin Meyer, MCP, MVP LINK LINK LINK
"Bunky" <Bunky@discussions.microsoft.com> wrote in message news:1158F8F8-6350-4D26-8D1E-DC3EE06D7E2C@microsoft.com...
| Quote: | Arvin,
If I go for option 2, how can I tell the query to get the 2nd date or later? Is that possible? In COBOL (Yes, I am a dinosaur), you could access whatever level of a table you wanted by simply entering the name of the element and -1 for the first one down or -2 for the second one.
Thanks a bunch for your assistance!
"Arvin Meyer [MVP]" wrote:
You may have some trouble from the combo, because it only can provide a single value, but you have to other choices:
1. You can manually choose from a multi-select list box or: 2. Use the same rowsource as the combo in another query with the TOP predicate as :
SELECT TOP 4 DateField, ID FROM YourTable ORDER BY DateField Desc; -- Arvin Meyer, MCP, MVP LINK LINK LINK
"Bunky" <Bunky@discussions.microsoft.com> wrote in message news:4D283AAB-4D96-4D59-8B59-AAC69CF43CEF@microsoft.com... Good Day to All!
I have a form with a combo box on it that is sending dates to a query. The Combo Box has a source of Distinct dates from a table. The idea is when the user selects the 1st (most current date) it will use this date throughout all the queries in the series for the report. This is working fine. Now, I want to expand this like this: I want the 2nd and the 3rd and the 4th most current dates as well. I cannot use DateAdd because the dates a not a set number of days apart. How can I reference the dates not selected? I have limited the number of dates shown to 4 so regardless what date is chosen, I want the date chosen and the 3 that preceeds it.
My code to select the current date from the form is [forms]![UGPRform]![Combo1]
Thank you in advance for your assistance.
|
|
| |
| | | Bunky |  |
| Posted: Fri Sep 05, 2008 4:49 pm Post subject: Re: Combo Box feeding a query |  |
| |  | |
Oh, you cut me to the quick! <LOL>. I have figured another method that was so simple I don't know why I did not see it. Create 2 more Combo boxes; each has a pull down of the dates available and it is up to you to select the correct on for each Combo box. Just finished it and it works very well indeed.
Thank you for your assistance and wit(?)!!
Kent
"Arvin Meyer [MVP]" wrote:
| Quote: | COBOL databases, if I can remember back that far <lol> where almost always hierarchal, not relational. Access is an ISAM (Indexed Sequential Access Method) database. There is no predetermined order, which is why I had to create the Order By clause. -- Arvin Meyer, MCP, MVP LINK LINK LINK
"Bunky" <Bunky@discussions.microsoft.com> wrote in message news:1158F8F8-6350-4D26-8D1E-DC3EE06D7E2C@microsoft.com... Arvin,
If I go for option 2, how can I tell the query to get the 2nd date or later? Is that possible? In COBOL (Yes, I am a dinosaur), you could access whatever level of a table you wanted by simply entering the name of the element and -1 for the first one down or -2 for the second one.
Thanks a bunch for your assistance!
"Arvin Meyer [MVP]" wrote:
You may have some trouble from the combo, because it only can provide a single value, but you have to other choices:
1. You can manually choose from a multi-select list box or: 2. Use the same rowsource as the combo in another query with the TOP predicate as :
SELECT TOP 4 DateField, ID FROM YourTable ORDER BY DateField Desc; -- Arvin Meyer, MCP, MVP LINK LINK LINK
"Bunky" <Bunky@discussions.microsoft.com> wrote in message news:4D283AAB-4D96-4D59-8B59-AAC69CF43CEF@microsoft.com... Good Day to All!
I have a form with a combo box on it that is sending dates to a query. The Combo Box has a source of Distinct dates from a table. The idea is when the user selects the 1st (most current date) it will use this date throughout all the queries in the series for the report. This is working fine. Now, I want to expand this like this: I want the 2nd and the 3rd and the 4th most current dates as well. I cannot use DateAdd because the dates a not a set number of days apart. How can I reference the dates not selected? I have limited the number of dates shown to 4 so regardless what date is chosen, I want the date chosen and the 3 that preceeds it.
My code to select the current date from the form is [forms]![UGPRform]![Combo1]
Thank you in advance for your assistance.
|
|
| |
|
|