MS Access Help, Possibly some VB too!

Tarrant64

Diamond Member
Sep 20, 2004
3,203
0
76
Alright, here it is to the point:

I have a table that I am getting information from including date values. I have a query that asks me for the Begin Date and End Date so I can get data from that date range. NOW, when I generate a report I want that Begin Date and End Date that I entered to show up. I don't want to have to enter it again when the report is generated. I want the header to include it automatically...

Is there anyway to have a VB script or something that will search data in a table and display to me what the earliest date is to the latest date entered?(you know, what was the begin date of that data and what is the end date). If anyone knows I would greatly appreciate an answer ASAP. Trying to add some features to an access database here at work and need it done either by tonight or early Monday.

Thanks!!!

P.S. If this is in the wrong forum please move it to wherever it needs to be so I can get help.
 

KLin

Lifer
Feb 29, 2000
30,952
1,080
126
1. create a form
2. create 2 text boxes, and a command button
3. have user put in start date in one text box, and end date in other text box
4. change the parameters in the query to reference the text boxes on the form
5. add in a control field on the report that also references those same text boxes
6. make the command box open the report
7. ...
8. PROFIT
 

Tarrant64

Diamond Member
Sep 20, 2004
3,203
0
76
Alright, that looks like it will work. Never looked at it that way. Thanks a lot! I will try that first thing Monday mornin'.
 
Nov 7, 2000
16,403
3
81
a simpler way -

in your query (design view), add 2 columns where the "field" values are
expr10:[Begin Date]
and
expr11:[End Date]

then, to filter the query for that range, in the column that is grabbing the date field from the table, in the criteria box, put this:

> [Begin Date] AND < [End Date]

When you execute the query, it iwll prompt you for the begin and end date (becuase those expressions are not defined from the table), and then filter the dates out using the criteria.

in your report, because you aliased those dates as expressions, you can reference the begin date with the control "expr10", and the end date with "expr11" (or whatever else you decide to call those expressions). everytime you open the report (becuase it is executing the query) it will ask you for those dates.

i know this works becuase im using in a db right now. i can help you out more if you are confused
 

KLin

Lifer
Feb 29, 2000
30,952
1,080
126
Originally posted by: HardcoreRobot
a simpler way -

in your query (design view), add 2 columns where the "field" values are
expr10:[Begin Date]
and
expr11:[End Date]

then, to filter the query for that range, in the column that is grabbing the date field from the table, in the criteria box, put this:

> [Begin Date] AND < [End Date]

When you execute the query, it iwll prompt you for the begin and end date (becuase those expressions are not defined from the table), and then filter the dates out using the criteria.

in your report, because you aliased those dates as expressions, you can reference the begin date with the control "expr10", and the end date with "expr11" (or whatever else you decide to call those expressions). everytime you open the report (becuase it is executing the query) it will ask you for those dates.

i know this works becuase im using in a db right now. i can help you out more if you are confused


That would work too. I don't like putting user input in queries just for the fact if you're troubleshooting something, it can get annoying if you have to keep going into datasheet view, and having to put in the dates over and over again.
 

Tarrant64

Diamond Member
Sep 20, 2004
3,203
0
76
Alright, thanks a lot. Sorry about not replying sooner. Haven't been back to work to try some stuff on the database. I'll check it out. I'll do both and see which one i prefer best.