Results 1 to 4 of 4

Thread: code (2000)

  1. #1
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    code (2000)

    Hello, I am trying to force form entry with this code

    Private Sub Form_BeforeUpdate(Cancel As Integer)


    If IsNull(Me.contract) Then
    Me.contract.SetFocus
    MsgBox "Please select 'A Contract'", vbExclamation
    Cancel = True
    Exit Sub
    End If

    end sub

    contract is an option group with buttons yet the code doesn't force entry. It does on other parts of the form, am I missing something?

    Thanks Darren.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: code (2000)

    Are you sure that the option group is null? Perhaps it has a default value set?

  3. #3
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: code (2000)

    Doesn't have a default option but I have put on as 0 and changed my code to say if contact = 0 then ....

    Has resolved. Still puzzled by why it wouldn't do it initially though. Not to worry.

    Thanks Darren.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: code (2000)

    What is the data type of the field the option group is bound to? A Yes/No field is never null, it is either 0 = False or -1 = True.

Posting Permissions

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