Results 1 to 4 of 4
  1. #1
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76

    cascading combo box issue

    This is my statement:

    Dim InsName As String


    InsName = "SELECT [Tbl_RentalRate].[Instrument]," & _
    " [Tbl_RentalRate].[RentalType]," & _
    " [Tbl_RentalRate].[RentalRate] " & _
    "FROM Tbl_RentalRate " & _
    "WHERE [Instrument] = " & Me.cmboInstrument.Value
    Me.cmboRentalType.RowSource = InsName
    Me.cmboRentalType.Requery


    I select the instrument form cmboInstrument all is good, when I go to cmboRentalType to view the filtered list, a Parameter Value box opens and I have to type the value already selected in cmboInstrument field to get the filter to work.
    What is going wrong with the statement that the parameter value box is opening?



    Thanks.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    you dont need to use .value, (Me.cmboInstrument.value) value is the default property.

    you cant use
    Me, in a query. ME is for a form to see objects in the form. DONT USE 'ME' AT ALL.
    in a query you must use the full path to the form object:
    forms!frmFormName!cmboRentalType

    you dont need to rebuild the sql every time. just assign a query to the combo.
    cmboRentaltype.rowsource = "qsQuery2"

    in the query qsQuery2, it has that sql that looks at the combo. NO need to keep rebuilding it.

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    In your SELECT statement, you have the RentalRate field twice.

    Maybe something like ...
    Code:
     Dim strInsName As String
    
     strInsName = "SELECT [Tbl_RentalRate].[Instrument]," & _
                  " [Tbl_RentalRate].[RentalRate]" & _
                  " FROM Tbl_RentalRate" & _
                  " WHERE [Instrument] = " & Me.cmboInstrument.Value
     
     Me.cmboRentalType.RowSource = strInsName
    
     Me.cmboRentalType.Requery

  4. #4
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76
    Thanks Ranman, your suggested made for a much cleaner solution that is working great.

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

Similar Threads

  1. Cascading Form issue
    By GSevensM in forum Forms
    Replies: 7
    Last Post: 04-03-2014, 11:51 AM
  2. Cascading ComboBox Issue
    By Nippy in forum Forms
    Replies: 4
    Last Post: 03-13-2014, 10:06 PM
  3. Replies: 1
    Last Post: 02-27-2014, 03:43 PM
  4. Cascading combos issue
    By Andyjones in forum Programming
    Replies: 5
    Last Post: 04-14-2012, 11:09 AM
  5. Cascading Combo Box
    By nywi6100 in forum Forms
    Replies: 0
    Last Post: 10-23-2006, 01:45 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