Results 1 to 2 of 2
  1. #1
    ggs is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    New Zealand
    Posts
    36

    Open Report by Combo Box selection Me.again

    Hi heres a code June 7 helped me with a couple of months back but i,ve been asked to do some changes
    The cboBranch was a text box unbound with Row Source a value list.
    The BranchNameID (was Depot) was also row source from a value list.


    Now the ComboBox is
    Control Source BranchNameID
    Row Source tblBranch
    Row source Type Table Query
    tblBranch is only two fields ID and BranchName and BranchNameID is the foreign key in the main table
    The report works all OK from a command button to show all records but obviously I'm now comparing the Text in the cbo with a number from the ID and it is not going to happen. I'm trying all sorts to get the bound column right. but to no avail
    I thought Me.cboBranch.Column(1) might do the trick
    been playing around in the properties for way to long now


    Private Sub cmdFilter_Click()
    Dim strWhere
    If Not IsNull(Me.cboBranch) Then
    strWhere = strWhere & "[BranchNameID]='" & Me.cboBranch & "'"
    End If
    If Not IsNull(Me.txtStartDate) Then
    strWhere = strWhere & IIf(strWhere = "", "", " AND ") & "[date_inc] Between #" & Me.txtStartDate & "# AND #" & Me.txtEndDate & "#"
    End If
    DoCmd.OpenReport "rptIncListing", acViewPreview, , strWhere
    End Sub

    Thanking you in advance

  2. #2
    ggs is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    New Zealand
    Posts
    36

    Me.Again

    I have just seen a fundemental design flaw here. Not seeing the Trees for the Forest. My cbo has to be a value list otherwise every time a user does a filter he changes the record.
    Timewaster

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 06-23-2014, 12:19 PM
  2. Using a combo box to open a report
    By Bill Casanova in forum Forms
    Replies: 24
    Last Post: 05-24-2011, 10:42 AM
  3. Replies: 4
    Last Post: 01-24-2011, 07:11 PM
  4. Replies: 1
    Last Post: 08-26-2009, 10:45 AM
  5. Replies: 3
    Last Post: 02-26-2009, 10:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums