trying to make it so that when you open the report, it'll pop a dialog box for users to choose the dates (from date to to date. ie. 04/15/05 to 07/17/05). When I click on the report, dialog shows up fine but it finds every record... can someone please help me with this.
here's the coding for the report
Option Compare Database
Option Explicit
Public Sub cmdCancel_Click()
' Method in all forms to allow clean close
DoCmd.Close acForm, Me.Name
End Sub
Private Sub cmdPrint_Click()
' Validate the dates
If Not IsDate(Me.txtFromDate) Then
Me.txtFromDate.SetFocus
MsgBox "You must enter a valid From date.", vbCritical, gstrAppTitle
Exit Sub
End If
If Not IsDate(Me.txtToDate) Then
Me.txtToDate.SetFocus
MsgBox "You must enter a valid To date.", vbCritical, gstrAppTitle
Exit Sub
End If
If Me.txtFromDate > Me.txtToDate Then
Me.txtFromDate.SetFocus
MsgBox "The From date must be less than or equal to the To date.", _
vbCritical, gstrAppTitle
Exit Sub
End If
' Hide me so the calling report can run
Me.Visible = False
End Sub
Private Sub cmdToDateCal_Click()
Dim varReturn As Variant
' Clicked the calendar icon asking for graphical help
' Put the focus on the control to be updated
Me.txtToDate.SetFocus
' Call the get a date function - date only
varReturn = GetDate(Me.txtToDate, True)
End Sub
Private Sub Form_Open(Cancel As Integer)
' Set up the form caption
Me.Caption = Me.OpenArgs
' Set up the label
Me.lblTitle.Caption = "Select Dates for " & Me.OpenArgs
End Sub
and coding for the form i designed.
Option Compare Database
Option Explicit
Public Sub cmdCancel_Click()
' Method in all forms to allow clean close
DoCmd.Close acForm, Me.Name
End Sub
Private Sub cmdFromDateCal_Click()
Dim varReturn As Variant
' Clicked the calendar icon asking for graphical help
' Put the focus on the control to be updated
Me.txtFromDate.SetFocus
' Call the get a date function - date only
varReturn = GetDate(Me.txtFromDate, True)
End Sub
Private Sub cmdPrint_Click()
' Validate the dates
If Not IsDate(Me.txtFromDate) Then
Me.txtFromDate.SetFocus
MsgBox "You must enter a valid From date.", vbCritical, gstrAppTitle
Exit Sub
End If
If Not IsDate(Me.txtToDate) Then
Me.txtToDate.SetFocus
MsgBox "You must enter a valid To date.", vbCritical, gstrAppTitle
Exit Sub
End If
If Me.txtFromDate > Me.txtToDate Then
Me.txtFromDate.SetFocus
MsgBox "The From date must be less than or equal to the To date.", _
vbCritical, gstrAppTitle
Exit Sub
End If
' Hide me so the calling report can run
Me.Visible = False
End Sub
Private Sub Form_Open(Cancel As Integer)
' Set up the form caption
Me.Caption = Me.OpenArgs
' Set up the label
Me.lblTitle.Caption = "Select Dates for " & Me.OpenArgs
End Sub
codings from Microsoft "Building Access Applications"
viescas
any kind of help would be appreciated
here's the coding for the report
Option Compare Database
Option Explicit
Public Sub cmdCancel_Click()
' Method in all forms to allow clean close
DoCmd.Close acForm, Me.Name
End Sub
Private Sub cmdPrint_Click()
' Validate the dates
If Not IsDate(Me.txtFromDate) Then
Me.txtFromDate.SetFocus
MsgBox "You must enter a valid From date.", vbCritical, gstrAppTitle
Exit Sub
End If
If Not IsDate(Me.txtToDate) Then
Me.txtToDate.SetFocus
MsgBox "You must enter a valid To date.", vbCritical, gstrAppTitle
Exit Sub
End If
If Me.txtFromDate > Me.txtToDate Then
Me.txtFromDate.SetFocus
MsgBox "The From date must be less than or equal to the To date.", _
vbCritical, gstrAppTitle
Exit Sub
End If
' Hide me so the calling report can run
Me.Visible = False
End Sub
Private Sub cmdToDateCal_Click()
Dim varReturn As Variant
' Clicked the calendar icon asking for graphical help
' Put the focus on the control to be updated
Me.txtToDate.SetFocus
' Call the get a date function - date only
varReturn = GetDate(Me.txtToDate, True)
End Sub
Private Sub Form_Open(Cancel As Integer)
' Set up the form caption
Me.Caption = Me.OpenArgs
' Set up the label
Me.lblTitle.Caption = "Select Dates for " & Me.OpenArgs
End Sub
and coding for the form i designed.
Option Compare Database
Option Explicit
Public Sub cmdCancel_Click()
' Method in all forms to allow clean close
DoCmd.Close acForm, Me.Name
End Sub
Private Sub cmdFromDateCal_Click()
Dim varReturn As Variant
' Clicked the calendar icon asking for graphical help
' Put the focus on the control to be updated
Me.txtFromDate.SetFocus
' Call the get a date function - date only
varReturn = GetDate(Me.txtFromDate, True)
End Sub
Private Sub cmdPrint_Click()
' Validate the dates
If Not IsDate(Me.txtFromDate) Then
Me.txtFromDate.SetFocus
MsgBox "You must enter a valid From date.", vbCritical, gstrAppTitle
Exit Sub
End If
If Not IsDate(Me.txtToDate) Then
Me.txtToDate.SetFocus
MsgBox "You must enter a valid To date.", vbCritical, gstrAppTitle
Exit Sub
End If
If Me.txtFromDate > Me.txtToDate Then
Me.txtFromDate.SetFocus
MsgBox "The From date must be less than or equal to the To date.", _
vbCritical, gstrAppTitle
Exit Sub
End If
' Hide me so the calling report can run
Me.Visible = False
End Sub
Private Sub Form_Open(Cancel As Integer)
' Set up the form caption
Me.Caption = Me.OpenArgs
' Set up the label
Me.lblTitle.Caption = "Select Dates for " & Me.OpenArgs
End Sub
codings from Microsoft "Building Access Applications"
viescas
any kind of help would be appreciated