Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004

    Unanswered: How to check reference to control

    I have the following code:

    dim ctrl as combobox

    ctrl = me.combo1 (this line gets executed only in some cases)

    (control1 is disabled and created on my form at design time).

    How can check if the assignement ctrl=me.combo1 has taken place?

    I tried isnull(ctrl), but this always returns True.

    Thanks in advance!

  2. #2
    Join Date
    Mar 2004

    small error

    Of course, the assignment should be:
    set ctrl=me.combo1

    (but this still doesn't solve the problem)

  3. #3
    Join Date
    Mar 2004

    Re: small error

    I found the solution. The reference should be checked against Nothing. However, the function IsNothing is not supported in VBA Access. The following is a workaround I found on the internet:

    Public Function IsNothing(pvarToTest As Variant) As Boolean
    On Error Resume Next
    IsNothing = (pvarToTest Is Nothing)
    On Error GoTo 0
    End Function 'IsNothing]

Posting Permissions

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