Results 1 to 3 of 3
  1. #1
    NYCAcess is offline Novice
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    1

    Newbie How to have form change??

    Hi -



    I'm new to access and trying to learn quickly. Before building a database and having to completely redo it I thought I would ask my question first.

    I'm creating a database for employees in a camp and need some different information for workers that are under 18. I would like to create a form with a check box that says over 18. If the box is checked then certain fields would gray out. If the box is unchecked then all fields can have information entered.


    Is this something possible or should I just make the form with lots of notes so that the staff person putting the information in sees which fields are for over 18 only.

    Thanks for any help and advice in advance.

  2. #2
    Join Date
    May 2010
    Posts
    339
    Every thing you mention is a possibility. Just take your time building your tables. They are the foundation that your forms/queries/reports/etc..etc..will be based on. Post back with your field ideas when you get there. You can also setup up a memo field that can hold notes.

    Regards,

    Richard

  3. #3
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    For this you need to have a Boolean (Yes/No) Field in your table. Now You create a form you need to add a code to the afterupdate event of the checkBox field. e.g.
    Lets take the Boolean Field as Ctl18_yrs if its not Checked the Field A2 on the Form will be disabled meaning that the user will not be able enter anything in it. The trick is to make sure that A2 is always Disabled until and unless 18Years is Checked.

    So I add this code on to the oncurrent event of the Form.

    Me.A2.Enabled = False

    This ensures That the Field A2 is Disabled when the Form opens. It also ensures that it is Disabled when you navigate.

    Now I add another Code to the AfterUpdate Event of Ctl18_yrs

    Select Case Me.Ctl18_yrs
    Case Is = True
    Me.A2.Enabled = True
    Case Is = False
    'Me.A2=vbNullString
    Me.A2.Enabled = False
    End Select

    This Code will enable A2 when you check an disable A2 when you uncheck the
    Ctl18_yrs. Adding the highlighted line will delete any value that is in A2 if you Check of Ctl18_yrs for an entry that you had previously Checked Ctl18_yrs. To include the Highlighted line of Code make sure that your Field Allows Zero Length, you can check it in the Field property in the Table Design view.

    Hope this gives you some Idea.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Change Password form
    By turbo910 in forum Forms
    Replies: 16
    Last Post: 05-07-2015, 09:02 AM
  2. List box not reflecting change on a form
    By vladimir.tz in forum Forms
    Replies: 7
    Last Post: 05-06-2010, 03:37 AM
  3. Color change in form filed
    By miziri in forum Programming
    Replies: 3
    Last Post: 08-15-2009, 04:53 PM
  4. Change to Form Closes Access
    By jbhjm in forum Forms
    Replies: 5
    Last Post: 04-22-2009, 01:04 PM
  5. Change the colour of a form background
    By r_e_v_a_n_s in forum Forms
    Replies: 0
    Last Post: 11-15-2005, 03:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums