Results 1 to 2 of 2

Thread: form help

  1. #1
    Join Date
    Jan 2006
    Posts
    1

    Unanswered: form help

    dear people
    i just registered at this forum. thank you!
    i am a newbei to Access. i have no programming experience. i need help with a form.

    i have a small database of children supported by sponsors abroad. in the form to enter the children's data, there is a field for "Does the child attend school?". the next field is "if yes what type of school?".

    what i want to do is that to keep the "If yes what type of school?" greyed out to begin with. then if the answer to "Does the child attend school?' is "yes" the "if yes type of school?" field should be enabled. other wise not.

    can any one help me?
    car313

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Hi Car313, and welcome to the forum.....

    you can do what you want to but you will need to place some code to run behind the form.

    lets asume you are using a checkbox for your value, lets call it ckbAttendsSchool, and another control called say TypeofSchool

    if we interogate that value then we can make decisions based on that value

    Code:
    if ckbAttendsSchool.value=true then
      TypeofSchool.enabled=true
    else
      TypeofSchool.enabled=true
    endif
    if you are only making a single setting a shorthand to that is
    Code:
    TypeofSchool.enabled = ckbAttendsSchool.value
    however if you are going to set multiple properties at the same time then use the if then else version
    you may need to use the if then else if say you wanted to blank out the typeofschool if the value in attends school changes to false.

    so having created the logic we now need to find a place to put it, in what condition do you think might want to set this value.


    offhand
    -when you insert a new record - implement in the forms "beforeinsert" event
    -when the value of ckbattendsschool changes - implement in the controls "onchange"
    -when you change records - implement in the forms "oncurrent" event

    so the next step to enter the code, it could be done as a macro or vb function - the choice is upto you.
    HTH
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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