Results 1 to 2 of 2
  1. #1
    DragonTech is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Posts
    8

    Report Filter

    I'm trying to use a command button in a form to filter and open a report. I am able to get it to open the report, but I cannot get it to filter the report based on a combobox in the form. I've tried every combination of code I could think of and find. Here is what I currently have:
    Code:
    Private Sub FilterReport_Click()
    DoCmd.OpenReport "Report", acViewReport, "First Name='" & Me.FName & "'"
    End Sub
    Code:
    Option Compare Database
    
    Private Sub Report_Open(Cancel As Integer)
    Me.RecordSource = Me.FName
    End Sub
    "FilterReport" = Form Button
    "Report" = Report


    "First Name" = Report Field
    "FName" = Form Combo Box

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Field names with embedded spaces need brackets.
    "[First Name] ='" & Me.FName & "'"

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

Similar Threads

  1. Replies: 4
    Last Post: 04-30-2014, 09:40 PM
  2. Replies: 1
    Last Post: 07-25-2013, 01:20 PM
  3. Replies: 2
    Last Post: 05-10-2013, 03:37 PM
  4. Help - trying to Filter on report
    By JulieBright in forum Reports
    Replies: 7
    Last Post: 04-20-2012, 02:35 AM
  5. Report Filter
    By SFC in forum Reports
    Replies: 4
    Last Post: 01-11-2012, 04:13 PM

Tags for this Thread

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