Results 1 to 6 of 6
  1. #1
    sesproul is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Posts
    50

    Capture 2nd Value in an unbound Combo.

    Hello,

    I have an unbound Combo (textbox) that has the following Rowsource Set

    Code:
    SELECT PartCatPREFIX, PartCatDescription FROM PartCategory;
    On the change event, I filter the Form based on the value.



    Code:
    '---This is the Part Filter
    
        If txtFilter = "" Then Exit Sub
        sStar = "*"
        sFilter = "[PartNo] like " & Chr(34) & sStar & txtFilter & sStar & Chr(34)
        Me.Filter = sFilter
        Me.FilterOn = True
        
        cmdAddNewPart.Enabled = True
        
        txtFilterView = ?????????? ' Can I call the second value directly
    the last line is where I would like to set a textbox txtFilterviewon the form to show the current filter selection to the PartCatDescription field.

    I could requery for the value in the textbox, but I was wondering if it is possible to call the second field in the rowsource directly?


    thanks

    Steve

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    in the properties of your combobox, let the Bound Column under the Data tab to 1 (the first one is column 0).

    Now the value of your second column will show on your me.cmbbox

  3. #3
    sesproul is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Posts
    50
    I believe that this is a 1 based control. So you mean use the column 2 value.

    I understand that, But I use the Bound column (1) value in the filter. So that wouldn't work for this situation. Is there a property of the control that I may access. i.e. txtFilter.Rowsource.fields(2) ???

    steve

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    if you have bound column (1) that should be your second column. As I said, it starts with 0 as the first column. if you have that setup you can use a query instead of a filter

    strSQL = "SELECT whatever FROM wherever WHERE mytable.PartNo Like (*" & me.txtbox & "*)"

  5. #5
    sesproul is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Posts
    50
    The Form is a bound form. So That is why I use the filter function. Is your example if I set the form recordsource to the Query results?

  6. #6
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    yes. I assume you have a subform displaying your results. You would run that query and then Me.Requery and Me.Refresh to update the subform.

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

Similar Threads

  1. Input data In unbound text box
    By chu3w in forum Forms
    Replies: 1
    Last Post: 04-01-2010, 10:21 AM
  2. Replies: 1
    Last Post: 03-26-2010, 10:32 PM
  3. Unbound Text box in reports
    By Overdive in forum Reports
    Replies: 1
    Last Post: 02-17-2010, 09:52 AM
  4. Use unbound boxes in a form
    By jjerome512 in forum Forms
    Replies: 2
    Last Post: 01-14-2010, 08:53 PM
  5. Get average of unbound textboxes.
    By markhook in forum Forms
    Replies: 8
    Last Post: 07-14-2006, 09:30 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