Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jul 2003
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Action on a new Form (2002)

    I have code on the OnCurrent event of a form that checks the status of a series of check boxes, and sets the Visiblility of others accordingly. This for was developed in Access 97 and converted to 2002 (It is a front-end in a multi-user, multi platform environment). Unlike in '97, in 2002 when I goto a new form I get an invalide use of Null error (I assume 'cause there is no value yet in the check boxes I am assigning to variables). Is there a way to skip this code when a record displayed is new? Thanks for your help! <img src=/S/please.gif border=0 alt=please width=31 height=23>

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

    Re: Action on a new Form (2002)

    One way would be to skip the code if you're on a new record: insert the following line at the beginning of Form_Current:

    If Me.NewRecord Then Exit Sub

    Alternatively, you could use the Nz function to replace Null values by the value of your choice, for example

    If Nz(Me.chkSomething, False) = True Then
    ... ' your code goes here
    End If

    If the first argument to Nz is Null, it will return the second argument instead.

  3. #3
    Star Lounger
    Join Date
    Jul 2003
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Action on a new Form (2002)

    Perfect! That Me.NewRecord piece was exactly what I was looking for.

Posting Permissions

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