Re: Open Report based on a drop down box

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thank you so much guys, I wil try your suggestions and let you know.
Ismail
Marshall Barton wrote:
I am using a form to run a report based on a combo box and it's working fine.

[quoted text clipped - 15 lines]
DoCmd.OpenReport "Qrytest", acViewPreview, , strWhere
End Sub

Just add more If blocks of code and add " AND " for each
condition. Then general idea is something like this:

If IsNull(Combo0) = False Then
strWhere = " AND ProvNm = '" & Combo0 & "'"
End If

If IsNull(txtStart) = False Then
strWhere = " AND datefield >= " _
& Format(txtStart, "\#m\/d\/yyyy\#")
End If

If IsNull(txtEnd) = False Then
strWhere = " AND datefield <= " _
& Format(txtEnd, "\#m\/d\/yyyy\#")
End If

strWhere = Mid(strWhere, 6) 'dump extra AND


--
Message posted via http://www.accessmonster.com
.



Relevant Pages

  • Re: Open Report based on a drop down box
    ... Beautiful. ... Marshall Barton wrote: ... End Sub ...
    (microsoft.public.access.formscoding)
  • Re: goof up in a yes/no update field code
    ... submission stuff just happens.... ... "Marshall Barton" wrote: ... Private Sub RSP_AfterUpdate ... you would use [Event Procedure] in an event ...
    (microsoft.public.access.formscoding)
  • Re: Elapsed Time and Edits
    ... Marshall Barton wrote: ... That code won't even compile so it doesn't matter ... block type statement such as If - Else - End If, ... Private Sub Form_Current ...
    (microsoft.public.access.formscoding)
  • Re: Form & Report
    ... Private Sub Command62_Click ... "Marshall Barton" wrote: ... The Service Order is a report. ...
    (microsoft.public.access.reports)
  • Re: goof up in a yes/no update field code
    ... "Marshall Barton" wrote: ... display new fields when one of them are marked yes. ... Private Sub RSP_AfterUpdate ... you would use [Event Procedure] in an event ...
    (microsoft.public.access.formscoding)