Results 1 to 5 of 5
  1. #1
    Lyn Mac
    Guest

    Clarification: Cancel variable in event procs (Access 2000 sr1a)

    In some event procedures, i.e. BeforeUpdate, Exit etc., the Cancel variable(?) is declared as an Integer.
    However, in the procedures Cancel is used as "Cancel = True".
    If I understand correctly, Integer are numbers up to 37,000 plus, while True of False are Boolean type.
    I think I am missing something, please clarify and thanks in advance.

    Lyn

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clarification: Cancel variable in event procs (Access 2000 sr1a)

    A boolean in access is a numeric variable that can only have the values
    0 (False)
    or
    -1 (True)

    True and False are system constants that also have those values assigned.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Clarification: Cancel variable in event procs (Access 2000 sr1a)

    To take that a step further, zero is always evaluated as False and any non-zero value is evaluated as True. In the earliest versions of Access, there was no boolean datatype and this may also be a holdover from that era.
    Charlotte

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Clarification: Cancel variable in event procs (Access 2000 sr1a)

    And we got burned by that when we upgraded to SQL 2000. In prior versions you could put a -1 in a criteria instead of typing True (and we did that). But SQL 2000 doesn't know about -1 in a boolean (bit) datatype, it likes only 1 and True, and we had lots of fun looking through 30 odd databases to find the places in Access and in SQL Views and Sprocs to find minus 1s. Moral - use True and False as Criteria.
    Wendell

  5. #5
    Lyn Mac
    Guest

    Re: Clarification: Cancel variable in event procs (Access 2000 sr1a)

    Thanks folks. It was enlightening. Now I know.

    Lyn

Posting Permissions

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