Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Location
    Cary, NC
    Posts
    264

    Unhappy Unanswered: data validation comparison

    I have a combo box where the rowsource is dependent on another combo box. When the first one changes, I requery the second to keep it up to date. If the value in the second combo before the requery is the only option available after the requery then I want to keep the value otherwise I want to erase it. As part of this test, I have the following line.

    If cboCenter.Value <> cboCenter.Column(0, 1) Then

    They do not come back as the same datatype and therefore do not equal. How should I be doing this test?

    I already have the test checking to make sure the combo box only has one available option, I just want to know if the value in the combo before the test is the same value that is in the list after the test.

    Steve

  2. #2
    Join Date
    Feb 2004
    Posts
    533
    If the value in the second combo before the requery is the only option available after the requery then I want to keep the value otherwise I want to erase it.
    How about just checkng the list count

    If Me.cboCenter.ListCount > 1 Then
    ' Remove Value
    ' Refresh your List
    End If

    OK you did that?
    I already have the test checking to make sure the combo box only has one available option, I just want to know if the value in the combo before the test is the same value that is in the list after the test.
    In this case catch the value in a variable before refreshing. Then use convert type to string to ensure type match. If you dim a var for string (Dim strListVal as String) it will force a string type.

    strListVal = CStr(Me.cboCenter.Value)
    Last edited by savbill; 08-16-04 at 18:35.
    ~

    Bill

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •