Results 1 to 4 of 4
  1. #1
    madhu is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2013
    Posts
    2

    yes or no options

    hai sir am a beginer of access2007 . i want to know some information about the yes or no options sir.
    actually i devoloped a one data base .
    in that it have a question sir
    for example
    name ishemarried wifename these three fields in database
    for ishemarried it have aoptions yes or no .
    if the answer is yes it can allow to write a wifename


    if it is no it can skip to the name field
    how can i do this sir
    can any one help me

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Hi Madhu,

    Are the three fields you mention [name, ishemarried, wifename] in a Table - or are they on a Form?

    Assuming that your Table has Name, IsHeMarried & WifeName fields:
    1. Make sure that the IsHeMarried field in the Table is a Yes/No type [Boolean].
    2. Create a Form based on the Table.
    3. Access should create the Form with a Check Box for the 'IsHeMarried' field.
    4. In your Data Entry Form - set the WifeName field Visible property to No.
    5. Select the Check Box - Right-Click - and open Properties.
    6. In the Properties -> Event Tab -> On Click -> click the [...] elipsis to the right and then select Code Builder.
    You will get something that looks like this:
    Code:
    Private Sub Married_Click()
    
    End Sub
    7. Add this between the two lines [Private Sub . . . & End Sub].
    Code:
    Me.WifeName.Visible = True
    Me.WifeName.SetFocus
    When you run the Form, the WifeName field will not be visible.
    If you click the IsHeMarried Check Box - the WifeName field will become visible and the cursor will be in that field ready for you to type in the wife's name.

    I hope this helps.

    P.S. You should try not to have a field called 'name' - because 'name' is a reserved word in Access/VBA. I usually use substitutes like 'CustomerName' . . . or 'StudentName' . . . or 'EmployeeName' - when I have a name field.

  3. #3
    madhu is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2013
    Posts
    2
    hai sir thanks for responding
    i have one more doubt sir
    if we give the yes or no options it display the one check box only
    i want to display the both the check boxes one for yes and one for no

  4. #4
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Your field 'IsHeMarried' - is only asking ONE question - Is He Married?
    The answer can only be Yes . . . or No.
    Right?
    Therefore - ONE check box is best.
    They way I suggested when the check box is checked - you automatically get a 'Yes' - or 'True' in your Table - without doing any VBA coding.

    You CAN put two check boxes on the Form if you want - but [I believe] it will be a misuse of the concept of the check box - which allows ONE control on a Form to provide one of only two possible answers to the question 'Is he married?' - and put the answer in your Table.
    And it will be redundant [like putting your tea in two cups instead of one - can you do it - sure - but what's the use?].
    In your code - you will be checking to see what the 'state' of both check boxes is - instead of just checking one.

    If you put two check boxes on the form - they cannot both be 'bound' to the same field in your Table.
    So - you will have to make the two check boxes 'unbound' - and you will lose the 'automatic' nature of using one check box that IS bound to that field in the table.

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

Similar Threads

  1. privacy options
    By slimjen in forum Forms
    Replies: 1
    Last Post: 03-22-2013, 12:12 PM
  2. Options view
    By Mark@CHP in forum Database Design
    Replies: 1
    Last Post: 06-15-2012, 05:37 PM
  3. Access Options
    By arunsule in forum Programming
    Replies: 2
    Last Post: 08-02-2011, 12:41 PM
  4. Networking Options
    By Robertag in forum Access
    Replies: 1
    Last Post: 03-13-2011, 01:16 PM
  5. Grouping Options
    By Desstro in forum Queries
    Replies: 1
    Last Post: 06-20-2010, 06:33 PM

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