Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2009
    Location
    Wimbledon, SW London, UK
    Posts
    19

    Converting Option value to text


    I have a form with a Frame containing three option buttons, which return the values 1, 2 or 3.

    However I want the underlying database field to contain "Book", "Video" or "DVD" (rather than 1, 2 or 3).

    As the Option values can only be numeric, how do i get the text values into the table?

    So far I have the following code (which fails) :

    Code:
    Private Sub Frame1_AfterUpdate()
        If Me.Frame1 = 1 Then
            tblBooks!Resource = "Book"
        End If
    End Sub

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    just repeat that stack of code for 2 and 3....

  3. #3
    Join Date
    Nov 2009
    Location
    Wimbledon, SW London, UK
    Posts
    19
    No, like i say it fails. The first problem is that on compiling, it returns the error "Variable not found" referring to "tblBooks" (and the table tblBooks does indeed exist).

    The full sub is :
    Code:
    Private Sub Frame1_AfterUpdate()
        If Me.Frame1 = 1 Then
            tblBooks!Resource = "Book"
        ElseIf Me.Frame1 = 2 Then
            tblBooks!Resource = "Video"
        Else
            tblBooks!Resource = "DVD"
        End If
    End Sub

  4. #4
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    you need to refer to the control in the form - not the table itself....

    so that when OptionGrp is = 1 then Me.TextBoxName = "Book"

    part of this fix depends on what you have now...the OptionGrp should be unbound (because you are not wanting 1,2,3 going to the table)....so then you have Me.textboxName is the field that is bound so that when you fill it with this code the word "Book" goes to the table....

    If OptionGrp is currently bound to the table; unbound it....you have to go to the table and if that field's property is number you need to make it text...

  5. #5
    Join Date
    Nov 2009
    Location
    Wimbledon, SW London, UK
    Posts
    19
    Ar that's it, brilliant, thank you

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

Similar Threads

  1. Active/Inactive Option
    By mikel in forum Database Design
    Replies: 6
    Last Post: 10-09-2009, 07:47 AM
  2. no option to import xls file or option all files
    By captgnvr in forum Import/Export Data
    Replies: 3
    Last Post: 09-22-2009, 10:19 AM
  3. Converting all text input to lower case
    By aommaster in forum Forms
    Replies: 6
    Last Post: 08-05-2009, 05:43 AM
  4. Option Group broken out
    By dcecil in forum Reports
    Replies: 3
    Last Post: 04-21-2009, 10:30 AM
  5. Browse Option
    By emilylu3 in forum Access
    Replies: 1
    Last Post: 01-10-2006, 09:46 AM

Tags for this Thread

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