Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2008
    Posts
    25

    Unanswered: Want checkboxes in form to write to table

    Hi there,

    New to Access so please accept my apologies for this beginner question!

    I have 3 checkboxes in a form, and want only one of them to be selectable. I then want the box selected to write to a column in a table. I realize one would normally use a dropdown for this, but I need the form to resemble a paper form.

    Seems simple enough, but I was having the problem of when one box was selected, the other 2 would be selected. So, I found some code to use on the AfterUpdate:

    Private Sub Check00_AfterUpdate()
    If Me.Check00 = True Then
    Me.Check01 = False
    Me.Check02 = False
    End If
    End Sub

    Unfortunately this did not work.

    Any suggestions?

    thanks,
    G

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    You need to place an Option Group on your form. Follow the Wizard's directions, and add the checkboxes at the appropriate time. Now only one of the checkboxes can be checked at any given time. Each checkbox will be assigned a numerical value, and you use the value of the Option Group when referring to it. If you don't change the name from the Wizard, it will addign a name such as Framen where n is a number. To refer to the value of, say, Frame1, you'd use

    If Me.Frame1 = 1 Then

    to say "if the first checkbox is checked" and so forth. If the Option Group is bound to a field in your underlying table, the numerical value will be stored. To "translate" what a given value means, such as in a Report, you'd use an unbound textbox with a Control Source to interpret what a given value means..
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    You'd be better for user interface consistency to use radio buttons rather than a checkbox.. a check box infers that any or none of the options can be selected (and each one is a different attribute), where as a radio button infers that only one button may be selected, and a button must be selected

    a check box is usually a yes / no for that specific element, whereas a group of radio buttons identify more than one option for that attribute. if you want to give a limited range of options for a specific attribute you'd use a radio button, if you wanted to identify specific (but unlinked/non competing) attributes you'd use a checkbox
    have a look at this if you want a better explanation, or any of the other nearly 2 million hits fond here
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Yup. 100% agreed. I remember in '95 reading a web-page (sites didn't really exist then ^^) on how NOT to design user interface elements. It was great and had some great examples of what not to do. I learned a lot from it. On that list was not to use checkboxes in a mutually exclusive content.

    Another was how after doing a search and replace, the button should read finish or done, not cancel as it STILL appears in Access. Seems Microsoft are a little slow to learn the basics!
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Aug 2008
    Posts
    25
    Hey thanks very much Missinglinq, its now working great!

    G

Posting Permissions

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