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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the value from a combobox as a control caption 1

Status
Not open for further replies.

dominicdunmow

Technical User
Jul 28, 2004
125
CA
Hi There,

I have a Year input combo box on a form. The options to choose are 05, 06, 07, 08 etc.

I'd liek to use this value in the caption of another control in a subform.

I'm part of the way there, but instead of retruning the 2 digit figure from the combobox, only a single digit is returned e.g. 5 instead of 05, etc.

I'm using

frm.Controls("3").Caption = "20" & Me.[Combo191]

The table field that the control is controlled by is formatted as "00" so I would expect the value of the combobox also to be 2 digits. Can anyone give me some advice please.

 
Either:
frm.Controls("3").Caption = 2000 + Val(Me![Combo191])
Or:
frm.Controls("3").Caption = "20" & Right("0" & Me![Combo191], 2)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top