Results 1 to 7 of 7
  1. #1
    david1011 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    9

    Smile Limit a Combo box based on text box value

    I have a combo box "result" - Fields are [ResultID]*, [resulttext], [card] - all write to a table "Result"


    also have a text box [Card] which carries an integer value

    I need to limit the combo based on the user's numerical entry in the [Card] field.

    failing miserably - is this possible?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Yes it is possible.

    You need to use a reference to the "Card" text box, as criteria, in the SQL statement used as the row source property of the combo box.

    Can you show us the SQL statement
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    david1011 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    9
    Private Sub Card_AfterUpdate()
    With Me![cboResultList]

    If IsNull(Me!Card)Then
    .RowSource =""
    Else
    .RowSource ="SELECT Result, ResultID " & _
    "FROM ResultList " & _
    "WHERE [Card]=" & Me!Result
    End If

    End With

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    David,

    Can you tell us in plain English what exactly should happen ( in business/non database terms)when the user enters a value in Card?

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    David. I will ask once more.

    Can you show us the SQL statement that is the RowSource of the combo box
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    david1011 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    9

    CBO qry statement:
    SELECT ResultList.Result, ResultList.ResultID, ResultList.ResultID
    FROM ResultList;SEL


    It does not limit the result list combo - all result items are listed
    bSkill2, SubSkillList2.SubSkill2ID,SubSkillList2.SubSkillID


  7. #7
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    It would limit the list in the combo box if it had a WHERE clause.

    The SQL statement given does not agree with the statement you made in post #1
    I have a combo box "result" - Fields are [ResultID]*, [resulttext], [card] - all write to a table "Result"

    When you said, "Fields
    are [ResultID]*, [resulttext], [card]" I assumed you meant these were the columns so I expected the SQL to be more like:
    Code:
    SELECT Result.ResultID, Result.resulttext, Result.card
    FROM Result;
    This needs to be clarified before you can add the WHERE clause.


    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 1
    Last Post: 08-27-2015, 01:11 PM
  2. Replies: 1
    Last Post: 04-14-2014, 01:38 PM
  3. Replies: 3
    Last Post: 03-15-2012, 02:27 PM
  4. Text Box Based on Combo Box
    By herbc0704 in forum Forms
    Replies: 3
    Last Post: 11-08-2011, 04:35 PM
  5. Replies: 1
    Last Post: 08-26-2009, 10:45 AM

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