Re: Code not working



Okay found the problem have no idea how to fix though

TOOnScene Between #08/05/1932# And #01/19/2006#

First date is being converted even though I have typed 01/19/06

"Allen Browne" wrote:

> If you open your table in design view, what data type is the TOOnScene
> field?
>
> Immediately above the DoCmd.OpenReport line, see:
> Debug.Print strWhere
> Then when you open the report, open the Immediate Window (press Ctrl+G), and
> see what it says is in the filter of the report.
> Then type this into the Immediate Window:
> ? Reports!DailyDispatch.Filter
>
> Hopefully that will help you to track down what is happening.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Jen" <Jen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:364E27E7-470B-45F7-AEF1-04C97AE8C33C@xxxxxxxxxxxxxxxx
> > Okay I got this off the internet and followed all the directions, it opens
> > my
> > report but displays all the dates not specific days. Please Help.....
> >
> >
> > Private Sub Command4_Click()
> >
> > Dim strReport As String
> > Dim strField As String
> > Dim strWhere As String
> > Const conDateFormat = "\#mm\/dd\/yyyy\#"
> >
> > strReport = "DailyDispatch"
> > strField = "TOOnScene"
> >
> > If IsNull(Me.txtstartdate) Then
> > If Not IsNull(Me.txtEndDate) Then
> > strWhere = strField & " < " & Format(Me.txtEndDate,
> > conDateFormat)
> > End If
> > Else
> > If IsNull(Me.txtEndDate) Then
> > strWhere = strField & " > " & Format(Me.txtstartdate,
> > conDateFormat)
> > Else
> > strWhere = strField & " Between " & Format(Me.txtstartdate,
> > conDateFormat) _
> > & " And " & Format(Me.txtEndDate, conDateFormat)
> > End If
> > End If
> >
> > DoCmd.OpenReport strReport, acViewPreview, , strWhere
> >
> > End Sub
> >
> > Private Sub Command5_Click()
> >
> > DoCmd.Close acForm, Me.Name
> >
> > End Sub
> >
>
>
>
.



Relevant Pages

  • Re: Form Field Validation On The Fly
    ... You should receive a prompt to warn you that the record could not be saved ... Allen Browne - Microsoft MVP. ... and time information to two hidden fields, another opens the next form which ... > Private Sub signin_button_MouseMove(Cancel As Integer, Button As Integer, ...
    (microsoft.public.access.formscoding)
  • Re: Looking for duplicates
    ... Allen Browne - Microsoft MVP. ... I thought of creating an unbound form with a subform in datasheet mode showing the existing records and then have a command button that when clicked opens another form showing the full details of the selected record for the user to view. ... Private Sub Form_BeforeUpdate ... DoCmd.Close acForm, strcForm ...
    (microsoft.public.access.formscoding)
  • Re: Automatic update of Date fields, Access 2003
    ... Access opens the code window. ... Private Sub Form_BeforeUpdate ... Allen Browne - Microsoft MVP. ... Use the BeforeUpdate event procedure of the form to set the field's ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Opening a report with Last Record or New Record
    ... Allen Browne - Microsoft MVP. ... the dealer number to carry over into that new record so I can place the ... Private Sub Form_Open ... But I want to check on the second form when it opens if the date ...
    (microsoft.public.access.formscoding)
  • Re: trapping users leaving new record b4 entring reqd data
    ... Allen Browne - Microsoft MVP. ... that out when i got your vba. ... Private Sub Form_BeforeUpdate ... Cancel = True ...
    (microsoft.public.access.modulesdaovba)