Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / August 2006

Tip: Looking for answers? Try searching our database.

Report filter

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
eddy - 03 Aug 2006 04:29 GMT
Hi,

I have a form called "OM_ASP_Scan" . User will search by "Tag No", numbers
that created by autonumber and input some information to update. I also have
created  two combo box  to specify print range between "Tag No" and a command
button to preview a report. In the On Click event  I've entered the following
code:

Private Sub Command48_Click()

On Error GoTo Err_Command62_Click

   Dim stDocName As String
 
   
   stDocName = "ASP_Detail"  'report name
   
DoCmd.OpenReport stDocName, acViewPreview, , "[Tag No] between " & Me!
[Combo44] & " and " & Me![Combo46]

Exit_Command62_Click:
   Exit Sub

Err_Command62_Click:
   MsgBox Err.Description
   Resume Exit_Command62_Click
End Sub

It's  working prefectly except  when I tried to add more combo box to filter
by user input date  that called "Date Send" field. I want  the report shows
the chosen date only. It was quite confusing to customize the code, due to
that I really appreciate if  anybody could give me some hand.

Thank you.

Regards

eddy

Signature

poyo's

Duane Hookom - 03 Aug 2006 04:39 GMT
I would rename the tagno combo boxes and use code like:
Private Sub Command48_Click()

On Error GoTo Err_Command62_Click

   Dim stDocName As String
   Dim strWhere as String

   stDocName = "ASP_Detail"  'report name
   strWhere = "1=1 "
   If Not IsNull(Me.cboFrom) Then
       strWhere = strWhere & " And [Tag No] >=" & Me.cboFrom
   End If
   If Not IsNull(Me.cboTo) Then
       strWhere = strWhere & " And [Tag No] <=" & Me.cboTo
   End If
   If Not IsNull(Me.cboDate) Then
       strWhere = strWhere & " And [Date Send] =#" & Me.cboDate & "#"
   End If
   DoCmd.OpenReport stDocName, acViewPreview, , strWhere

Exit_Command62_Click:
   Exit Sub

Err_Command62_Click:
   MsgBox Err.Description
   Resume Exit_Command62_Click
End Sub

Signature

Duane Hookom
MS Access MVP

> Hi,
>
[quoted text clipped - 38 lines]
>
> eddy
eddy - 03 Aug 2006 10:48 GMT
Thanks for your fast reply and it works perfectly!!

Thanks again, god bless you

Regards

Eddy

>I would rename the tagno combo boxes and use code like:
>Private Sub Command48_Click()
[quoted text clipped - 30 lines]
>>
>> eddy

Signature

poyo's

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.