Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbar to display Option....HOW??? 3

Status
Not open for further replies.

haytatreides

IS-IT--Management
Oct 14, 2003
94
US
This should be easy. and in VB it was, but I am having a lot of trouble with this (and feel foolish).
I am trying to have a textbox display a string value based on a radio button selection in my form. my radio buttons are Open and closed, with values of 1 and 2 respectively.
I want the textbar to display "Open" in blue or "Closed" in red. Right now I havent even tried the colors, I just want to get the text working.

If anyone can help me, I will give you my first born!

Hayt
 
There may be an easier way but this should work...

Private Sub OptionGroupName_BeforeUpdate(Cancel As Integer)

Select Case OptionGroupName.Value
Case 1
TextBoxName.Value = "Open"
TextBoxName.BackColor = vbBlue
Case 2
TextBoxName.Value = "Closed"
TextBoxName.BackColor = vbRed
End Select

End Sub
 
Check out the afterupdate event of the radio button's frame. The buttons should be in a frame, and that frame's value should be the value of whichever radio button is selected. Then you can write a sub/function to update the value of the text box based on the value of the radio button and call that sub/function in both the on current event of the forma nd the after update event of the radio button.

Is this value critical to your user? I'm just wondering why you need two visual clues as to the value (the radio button and the text box), and whether that's worth the user's frustration when she tries to change the text box value.

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Hi Hayt,

There are many ways you can do this, the above from Jason will color the whole textbox, if you only want the text colored then you would use the ForeColor property like this:

txtSelect = IIf(optSelect = -1, "Open", "Closed")
txtSelect.ForeColor = IIf(optSelect = -1, vbBlue, vbRed)


Regards,
gkprogrammer
 
Thanks everyone. I am going to try it now.

Jeremy, The textbox is in my header (my form is huge, and it is only for the IT Dept here. We need something quick to see, cause we dont have a lot of time, and some upper level execs aren't too computer savvy. This allows them to also see on reports the current status. As for an attempted change on the textbox, I have it as "microsoft gray" and flat (not sunken). It looks like a label (like in VB).

Thanks again!

hayt
 
Sorry, maybe i didnt do it correctly, but it did not work. I tried all three suggestions. No Going. Maybe I have the proerties on my txtStatus (textbox) wrong?
 
Post your code.

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Hayt,

Did you place the code I gave you in the Option buttons After_Update event procedure?

What didn't work, maybe you could post your code.

Regards,
gkprogrammer
 
Thanks anyway guys....We ended up putting that bit of functionality on Hold. There are some other things i need to work on first. But trust me, I will need help later. hehe. thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top