Results 1 to 2 of 2
  1. #1
    Soule is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2011
    Posts
    58

    Cascadinig Comboboxes Sql Refuse To Work

    Hi, Everyone,

    I'm trying to create a dynamic rowsource for my Combobox B, so that when a user makes a selection in Combobox A, B will give relavent choices.

    My environment is:
    - Access 2007
    - .accdb file
    - Button code in standard module pointed to with event procedures using Call subs
    - Am in datasheet view when compiling/stepping through/running
    - Early binding w/Intellisense
    - Libraries (in this order):
    VB for Apps
    MS Access 12.0 Obj. Lib.
    MS Outlook 12.0 Obj. Lib.
    MS OFC 12.0 Access db engine Obj. Lib.
    MS VB for Apps Extensibility 5.3
    MS VBScript Regular Expressions 5.5


    MS ActiveX Data Objects 2.8 Lib.
    OLE Automation
    - No compile, step-through or run-time errors

    Form: A1 Onboarding Tracking Form
    Table: A1 Movie Code Table

    Unbound Parent Combobox A: A1 Form RawMovieTitle View Control
    Combo A Row Source:
    Code:
    SELECT DISTINCT [A1 Movie Code Table].RawMovieTitle FROM [A1 Movie Code Table] WHERE [A1 Movie Code Table].MovieCodeSendDateClone IS NULL ORDER BY [A1 Movie Code Table].RawMovieTitle;
    Combo A Row Source Type: Table/Query

    Bound Child Combobox B: A1 OT Movie Code Control

    Combobox A's Row Source query uses null/not null on the MovieCodeSendDate field in the table and populates Combobox A with movie titles with at least one null return (empty date field).
    Combobox A populates fine based on its query row source. The problem I'm having is the Event Procedure SQL in my AfterUpdate() event:
    Code:
    Private Sub A1S1_Form_RawMovieTitle_View_Control_AfterUpdate()
    On Error Resume Next
       Me.[A1 OT Movie Code Control].RowSource = "Select [A1 Movie Code Table].RawMovieCode " & _
       "FROM [A1 Movie Code Table] " & _
       "WHERE (IsNull([A1 Movie Code Table].MovieCodeSendDateClone)) " & _
       "WHERE [A1 Movie Code Table].RawMovieCode = '" & [A1 Form RawMovieTitle View Control].Value & "' " & _
       "ORDER BY [A1 Movie Code Table].RawMovieCode;"
    Is there something wrong with what I've done here? The cascade Combobox B shows no values at all after the AfterUpdate() event coming out of Parent Combobox A.

    I can't put my finger on what's happening. The smallest advices will help. Thanks for reading!

    This post is also here http://www.utteraccess.com/forum/Cas...l#entry2218095

    Frank

  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,521
    You can't have 2 WHERE clauses. You'd separate conditions with AND or OR:

    WHERE Field1 = 123 AND Field2 = 'ABC'
    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. Validation of the comboboxes
    By dr223 in forum Access
    Replies: 1
    Last Post: 01-13-2012, 07:31 AM
  2. Cascade of 3 or more ComboBoxes
    By tomullus in forum Forms
    Replies: 4
    Last Post: 10-08-2011, 06:22 PM
  3. Comboboxes go where?
    By PaulCW in forum Database Design
    Replies: 12
    Last Post: 10-04-2011, 02:34 AM
  4. Subform with Comboboxes
    By Angate in forum Forms
    Replies: 5
    Last Post: 04-23-2010, 08:10 PM
  5. How to Reset Comboboxes
    By bbarrene in forum Programming
    Replies: 5
    Last Post: 01-23-2010, 11:11 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