Results 1 to 2 of 2

Thread: SetFocus

  1. #1
    Join Date
    Mar 2004
    Posts
    79

    Unanswered: SetFocus

    Several fields on my form cannot be null. After the validation text displays, I would like cursor to be set to field in error.
    I tried BeforeUpdate of form

    If Me.CustName Is Null Then
    Me.CustName.SetFocus
    EndIf

    but I get a runtime error saying Object Required???

  2. #2
    Join Date
    Feb 2004
    Posts
    137
    The code should read:
    Code:
    If IsNull(Me.CustName) = True Then
    Me.CustName.SetFocus
    EndIf
    Alternatively, the code could be:
    Code:
    If Me.CustName = Null Then
    Me.CustName.SetFocus
    EndIf
    You cannot use the criteria expression Is Null in Visual Basic, only in query expressions.

Posting Permissions

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