Results 1 to 3 of 3
  1. #1
    reality123 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    2

    Combo box Error on "All"

    I have a split form with a unbound combo box that queries based on the selection. That part queries fine, but I cannot get it to return all records if "All" is selected. I get the following error...

    Run-time error 3075

    Syntax error (missing operator) in query expression '[Assigned To] = All'

    Row Source
    SELECT Contacts.ID, Contacts.[Last Name] FROM Contacts; UNION SELECT "All","All" FROM Contacts;

    AfterUpdate
    Private Sub Combo81_AfterUpdate()
    Me.Filter = "[Assigned To] = " & Me.Combo81
    DoCmd.RunCommand acCmdApplyFilterSort
    End Sub

    I am fairly new to Access so please be patient. I am sure this is a easy fix for most of you.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    There is no such ID or Last Name value of 'All' in the table so the acCmdApplyFilterSort will fail. Is [Assigned To] the ID or Name value? The reference to Combo81 is probably returning the ID value.

    You need to have code handle the selection of 'All', something like:

    If Me.Combo81 = "All" Then
    Me.Filter = "[Assigned To] Like '*'"
    Else
    Me.Filter = "[Assigned To] = " & Me.Combo81
    End If
    DoCmd.RunCommand acCmdApplyFilterSort
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    reality123 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    2
    Works perfectly! Amazing how long I have spent on something so simple! 3 Hours the first time, 2 minutes the second time around. Your help is VERY APPRECIATED!

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

Similar Threads

  1. Replies: 2
    Last Post: 11-04-2011, 02:45 AM
  2. Replies: 16
    Last Post: 07-22-2011, 09:23 AM
  3. "Group By" causes "ODBC--Call Failed" error
    By kaledev in forum Queries
    Replies: 1
    Last Post: 03-09-2011, 02:43 PM
  4. Replies: 3
    Last Post: 03-07-2011, 08:37 PM
  5. Replies: 2
    Last Post: 12-02-2010, 02:35 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