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 / Forms / August 2007

Tip: Looking for answers? Try searching our database.

Picture Report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew C - 31 Jul 2007 06:48 GMT
Hi

On my reports form I have a command button that when you click it, it loads
a reportform on the criteria in my combo boxed.  I have pasted the code
below.  My problem is that it loads the report but for all the records and
not just the ones matching the criteria.  What am i missing, I am only
learning VB so will need a clear answer.

Private Sub Command15_Click()
   Dim strReport As String     'Name of report to open.
   Dim strField As String      'Name of your date field.
   Dim strWhere As String      'Where condition for OpenReport.

   strReport = "Items"

    If Not IsNull(Me.Combo12) Then
       If strWhere <> "" Then
           strWhere = "(" & strWhere & ") AND (subid= """ & Me.Combo12 &
""")"
       Else
           Me.Combo12 = SubID
       End If
   End If

   ' Debug.Print strWhere                   'For debugging purposes only.
   DoCmd.OpenReport strReport, acViewPreview, strWhere
   
   
End Sub

Thanks

Andrew
Damian S - 31 Jul 2007 06:54 GMT
Hi Andrew,

You aren't setting a value for strWhere, so it is never getting into that
portion of your if/then statement.

Damian.

> Hi
>
[quoted text clipped - 29 lines]
>
> Andrew
Andrew C - 01 Aug 2007 04:10 GMT
Thnks Damian

Can you give me a bit more info on how to fix the problem so i can set the
value.  I dont know much about VB and learning as i go

Thanks

Andrew

> Hi Andrew,
>
[quoted text clipped - 36 lines]
> >
> > Andrew
 
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.