Results 1 to 4 of 4
  1. #1
    OatmealJones is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2013
    Posts
    2

    Generate form based on combobox values


    Hello! First time poster on here! Here is my situation:

    My end product will be a little bit more complex but as of right now, I am just trying to make things work. I am using a pop-up form that allows the user to choose values from a table. The values are then to be used to filter the data in a report. I am getting a datatype mismatch error (error 3464) on the below code:

    Code:
    Private Sub cmdApplyFilter_Click()
            
            Dim strTeam As String
            Dim strFilter As String
            
            If IsNull(Me.cboTeam.Value) Then
                strTeam = "[Team] Like '*'"
            Else
                strTeam = "='" & Me.cboTeam.Column(1) & "'"
            End If
            
            strFilter = "[Team] " & strTeam
            
            With Reports![Soldier Details Report]
             .Filter = strFilter
             .FilterOn = True
            End With
    I am getting the error on the .Filter properties. I did some research and the only thing I can think of is since i am coding this based from a form, Access is assuming I am referring to the .Filter property for a form instead of a report and it provides me with the error. Only thing is, I don't know how to refer to the report .Filter etc. Any advice would be great, thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    What is the data type of the Team field? If it's numeric, you don't want single quote delimiters. Same concept as this:

    BaldyWeb wherecondition
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    OatmealJones is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2013
    Posts
    2
    Thanks! Deleted the single quotes and changed column to value in Column(0) for PK and it worked! thanks!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 09-06-2011, 01:47 PM
  2. Replies: 29
    Last Post: 08-16-2011, 05:52 PM
  3. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  4. Calculating values based on Combobox value
    By BrianFawcett in forum Programming
    Replies: 1
    Last Post: 05-06-2010, 01:26 AM
  5. Replies: 0
    Last Post: 12-16-2009, 01:14 PM

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