Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Oct 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing a Yes/No field in a table (Access 97)

    In a subform I have a control that is set to 0. Within a table I have a yes/no field which is set to "yes" that I want to set to "no" when the user enters a number that is greater then 0. On which control property do I set the code to On Enter or Afterupdate?

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Changing a Yes/No field in a table (Access 97)

    On the Yes/No controls Afterupdate.
    Pat <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  3. #3
    New Lounger
    Join Date
    Oct 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing a Yes/No field in a table (Access 97)

    Thank you Pat. In the Afterupdate yes/no control property, how would I change the tables' field to false from the subform.

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Changing a Yes/No field in a table (Access 97)

    Edited by John immediately. I had the yes/no's round the wrong way
    Exactly how you do it depends on whether the yes/no field is in the fields of the table/query that provides the data for the subform. If it is, you can just include a hidden copy of the yes/no field on the subofrm, then in the afterupdate event of the field that has the 0 in it, set the value of the yes/no field.
    eg. if the numberfield is called mynumber, and the yes/no myyesno have this code in the afterupdate event for mynumber:

    if me![mynumber]>0 then
    me![myyesno] = No
    else
    me!myyesno = Yes
    end if
    I am not sure whether you need to else bit !

    If you can't put the yes/no field on the form it is more complicated. You would need to run an update query.
    Regards
    John



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

    Re: Changing a Yes/No field in a table (Access 97)

    If the the control is bound to the field in the table, you don't have to do anything except set the control's value. That will automatically update the table when you move off the record.
    Charlotte

Posting Permissions

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