Change Option Group to Text String in Table to Automatically Print Report

  • Thread starter sripsky via AccessMonster.com
  • Start date
S

sripsky via AccessMonster.com

Hello Anyone,
I finally figured out how to chang the optiongroup number to a text string in my form. Now, could someone tell me how to create a control source for the field in a table so that when I generate a report I don't have to do an update query to make the change? Thanks.
 
S

Sprinks

Hi, sripsky.

I strongly advise against storing anything but an integer in a field bound
to an option group. To create the text you want, either create a calculated
field in a query using nested IIf statements (messy if you have a lot of
different values), or more compactly, create a custom function and store it
in a module:

Public Function MyString(intValue as Integer) As String
Select Case intValue
Case 1
MyString = "String for value 1"
Case 2
MyString = "String for value 2"
Case Else
MyString = ""
End Select
End Function

Then, set the Control Source on your report to:

=MyString([YourOptionGroupName])

Hope that helps.
Sprinks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top