Date Range? 
Author Message
 Date Range?

In Access 2000, I have a report that I need to set a date range in.

For example, when the user clicks the button on the main menu to open the
form, a message box is to pop up asking for a beginning date.  Once this is
filled in, the user clicks ok, then another message box pops up asking for
an ending date.  Once this is filed in, the user clicks ok, and the report
opens with the data listed in the report from the date range specified.

Can someone please tell me what code I need to put into the design view of
the query behind the report?

Thanks in advance.
Gary



Sun, 30 Oct 2005 03:15:44 GMT  
 Date Range?
On Tue, 13 May 2003 15:15:44 -0400, "Gary Nelson"

Quote:

>In Access 2000, I have a report that I need to set a date range in.

>For example, when the user clicks the button on the main menu to open the
>form, a message box is to pop up asking for a beginning date.  Once this is
>filled in, the user clicks ok, then another message box pops up asking for
>an ending date.  Once this is filed in, the user clicks ok, and the report
>opens with the data listed in the report from the date range specified.

>Can someone please tell me what code I need to put into the design view of
>the query behind the report?

On the Criteria line under the date field put:

Quote:
>= [Enter beginning date:] AND <= [Enter ending date:]

Or, better IMO, create a small unbound Form frmCrit with two
textboxes, txtStartDate and txtEndDate; use criteria of

Quote:
>= [Forms]![frmCrit]!txtStartDate AND <= [Forms]![frmCrit]!txtEndDate

and put a command button on the form to open the Report.

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



Sun, 30 Oct 2005 05:48:22 GMT  
 Date Range?
Hi ,

I  assume the report data source is a query , if so the  criteria  section
needs to have the following

between forms!formname!startdate and  forms!formname!enddate

this also need to be added to the parameters section showing the data type

create a form with two textboxs    startdata and enddate

Under code header

Option Compare Database
Option Explicit
Public Fopening as Boolean  ' add this public variable

then on the report on open event add this code

Private Sub Report_Open(Cancel As Integer)
Dim StrFormName As String
StrFormName = "FormName"
Fopening = True
DoCmd.OpenForm StrFormName, , , , , acDialog
If IsLoaded(StrFormName) = False Then Cancel = True
End Sub

and in the modules section add this routine

Function IsLoaded(ByVal StrFormName As String) As Integer
 ' Returns True if the specified form is open in Form view or Datasheet
view.

    Const conObjStateClosed = 0
    Const conDesignView = 0

    If SysCmd(acSysCmdGetObjectState, acForm, StrFormName) <>
conObjStateClosed Then
        If Forms(StrFormName).CurrentView <> conDesignView Then
            IsLoaded = True
        End If
    End If

End Function

regards

Ian


Quote:
> On Tue, 13 May 2003 15:15:44 -0400, "Gary Nelson"

> >In Access 2000, I have a report that I need to set a date range in.

> >For example, when the user clicks the button on the main menu to open the
> >form, a message box is to pop up asking for a beginning date.  Once this
is
> >filled in, the user clicks ok, then another message box pops up asking
for
> >an ending date.  Once this is filed in, the user clicks ok, and the
report
> >opens with the data listed in the report from the date range specified.

> >Can someone please tell me what code I need to put into the design view
of
> >the query behind the report?

> On the Criteria line under the date field put:

> >= [Enter beginning date:] AND <= [Enter ending date:]

> Or, better IMO, create a small unbound Form frmCrit with two
> textboxes, txtStartDate and txtEndDate; use criteria of

> >= [Forms]![frmCrit]!txtStartDate AND <= [Forms]![frmCrit]!txtEndDate

> and put a command button on the form to open the Report.

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



Mon, 31 Oct 2005 22:08:30 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Crystal Reports 8.5 date range parameter field - record selection that includes null date range

2. Create Date array using Date range

3. date range to current date at specific time syntax question

4. Q:get current date and then create date range

5. VBA COntrolled Date Range in SQL Query

6. Report based on date range

7. Calculate no of days in a month within a specified date range

8. Calculate Date Range From Prior Week

9. Problem with applying time taken off to a date range

10. Calling values from table based on date range criteria

11. Date Range - using day and month

12. Specify date range in DAO

 

 
Powered by phpBB® Forum Software