Results 1 to 11 of 11
  1. #1
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108

    Option Groups - change value from number to text

    I have a form with a set of option groups on it, and I have discovered that when using option groups, they store the selection in the table as a number, rather than text. So, I thought I could simply change the value in the properties box - and that didnt work at all...



    So... I did some research online, and found that you could create a hidden text box that would, based on the selection, match a value to a string of text in VB. Here is such an example that I have implemented.

    Code:
    Private Sub Frame404_AfterUpdate()
    Select Case Me![Frame404]
      Case 1
        Me![Text618] = "80+"
      Case 2
        Me![Text618] = "79-50"
      Case 3
        Me![Text618] = "49-33"
      Case 4
        Me![Text618] = "32-"
    End Select
    End Sub
    This seems it should work, however, the value does not transfer to the text box, and i get this error:

    "The expression After Update you entered as the event property setting produced the following error: A problem occured while Microsoft Access was communicating with the OLE server or ActiveX Control.

    *The expression may not result in the name of a macro, the name or a user-defined function, or [Event Procedure].
    *There may have been an error evaluating the function, event, or macro.

    Show Help >>

    This error occurs when an event has failed to run because the location of the logic for the event cannot be evaluated. For example, if the OnOpen property of a form is set to =[Field], this error occurs because a macro or event name is expected to run when the event occurs."

    Does anyone know what is going on and how this is corrected?

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    have you tried replacing the "me!" with "me."?? you don't get intellisense when you use "me!"

    also, control names that have no spaces do not need enclosures in brackets. try using the "." identifier

    how about trying to use "case = 1" instead of "case 1"?? not that it matters I don't think though.

  3. #3
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    Still not working... I modified my code as follows:

    Code:
    Private Sub Frame384_AfterUpdate()
    Select Case Me.Frame384
    Case 1
    Me.Text614 = "Above Average"
    Case 2
    Me.Text614 = "Average"
    Case 3
    Me.Text614 = "Below or None"
    End Select
    End Sub

  4. #4
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    i should also state that i switched "Case X" to "Case If = X"

  5. #5
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by nchesebro View Post
    i should also state that i switched "Case X" to "Case If = X"
    i don't get it. what?

  6. #6
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    You said:

    how about trying to use "case = 1" instead of "case 1"?? not that it matters I don't think though.
    I said:

    i should also state that i switched "Case X" to "Case If = X"
    Therefore, I did as you suggested.

  7. #7
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by nchesebro View Post
    Case If = X
    is not the same as
    Case = X
    , bud.

  8. #8
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    When entering "Case = X" into Micorsofts VB editor that pops up when you click 'view code' on the access toolbar, you cant simply type Case = X into the code. It inserts the If there regardless of what you do.

  9. #9
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    (laugh). I see. you typed it wrong, bud. it inserts the word "IS", not "IF".

    but regardless, that doesn't do anything either, huh?

  10. #10
    nchesebro's Avatar
    nchesebro is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2010
    Posts
    108
    Holy crap, you are right.... it IS is... funny how one stinkin letter messes it up and causes such embarassment...

    Nope, still doesnt make one damn difference... which is odd, because I would assume that this would be a simple fix since access seems to be so popular and, most forms use option groups... seems like they would take extra care to ensure a problem like this doesent happen...

    I will say, I am stumped...

  11. #11
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    i'm out of ideas, as I don't work with option groups much anyway. it might be related, and it might also be related to a corrupted object.

    last thing i'd say would be: create a new form JUST like this one that's causing the problem. don't copy anything, and don't use the same code OR the same module. do it all over again.

    if it happens again, it's narrowed down to the file as the corrupted part. see what I'm doing? narrow it down, one step at a time, and you can do it yourself.

    in terms of corruption, I've only had one time in my 10+ years of messing with Access that I actually found out that a module was corrupted. It's usually an object, namely forms or tables.

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

Similar Threads

  1. setting up option boxes for text values
    By wlumpkin in forum Access
    Replies: 4
    Last Post: 02-08-2011, 09:33 AM
  2. Replies: 3
    Last Post: 11-03-2010, 09:53 AM
  3. Replies: 3
    Last Post: 02-09-2010, 07:05 PM
  4. Converting Option value to text
    By James3mc in forum Forms
    Replies: 4
    Last Post: 11-28-2009, 11:19 PM
  5. Change Date Into Number
    By greenbag in forum Queries
    Replies: 0
    Last Post: 11-14-2008, 04:43 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