Results 1 to 4 of 4
  1. #1
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317

    Option groups and check boxes: sending text to a table

    Hi Folks

    What's the simplest way of getting option groups and text boxes to send custom text to a table (rather than, respectively, numbers and 'Yes'/'No')?



    Remster

  2. #2
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317
    An idea I've come up with is to have my option group unbound and to link it to a (hidden) bound text box via the following code:
    Private Sub OptionGroup_AfterUpdate()
    If Me.OptionGroup.Value = 1 Then Me.TextBox.Value = "Rod"
    If Me.OptionGroup.Value = 2 Then Me.TextBox.Value = "Jane"
    If Me.OptionGroup.Value = 3 Then Me.TextBox.Value = "Freddy"
    End Sub
    I don't know if this is the best way to do it or if it might cause any problems.

  3. #3
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317
    I've cocked it up! Because the option group is unbound, making a selection in one record seems to change the selection in all records. I don't know how I didn't spot this before.

    Is there any way round this or do I need to try something different entirely? One suggestion I've read is to use ...
    ShowText:Choose([OptionName],"High","Low","N/A")
    ... but I've no idea where to put this code.

  4. #4
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317
    Okay, I've worked it out. I needed to put the following in the form's OnCurrent event:
    If Me.TextBox.Value = "Rod" Then Me.OptionGroup.Value = 1
    If Me.TextBox.Value = "Jane" Then Me.OptionGroup.Value = 2
    If Me.TextBox.Value = "Freddy" Then Me.OptionGroup.Value = 3

    If IsNull(Me.TextBox.Value) Then Me.OptionGroup.Value = 0
    This allows the option group selection to be determined by what's already in the table, viz. nothing for a new record.

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

Similar Threads

  1. How do I add multiple table entries using check boxes?
    By avarusbrightfyre in forum Access
    Replies: 3
    Last Post: 10-21-2010, 01:09 PM
  2. To check or Un-Check all Boxes in a form
    By devcon in forum Forms
    Replies: 7
    Last Post: 05-01-2010, 12:03 AM
  3. Replies: 2
    Last Post: 03-30-2010, 05:08 PM
  4. VB code for sending email through Option Group?
    By getdpt in forum Programming
    Replies: 0
    Last Post: 08-23-2009, 03:59 PM
  5. Replies: 0
    Last Post: 04-19-2008, 09:08 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