View Full Version : Question HELP! Probably a simple solution....


tarcona
07-03-2008, 07:08 AM
This is probably an easy to do, but somehow I am stuck.

There is a field in my form that lists if the company is a hospital or clinic (OP or IP).

And then there is a field in my form that shows the size of the company. The label is "Size". I dont want that label to be "Size". IF the company is a hospital, I want the label to be "Beds". IF the company is a clinic, I want the label to be "Provider". Thanks.

I have tried this on the Before Update Event:

If Me.Out_Patient___In_Patient.Value = "IP" Then
Me.Size.Value = Provider
End If


But that is not working.

namliam
07-03-2008, 07:17 AM
Dont name labels size... Use a naming convention, this means for Labels you add in front lbl...
Forms get "frm"

Also DONT use underscores!!! How many underscores are in that name field in sequension?? I cannot tell...

So...
me.lblSize.Caption = "Beds"
Or something simular to that.

tarcona
07-03-2008, 07:32 AM
You havent helped me with my problem at all....
I want my label name to change in relation to another field.

namliam
07-03-2008, 07:38 AM
That is exactly what I am showing you how to do!!!
me.lblSize.Caption = "Beds"

Me.LabelName.Caption = "New value"

I have helped you and then some by above post, what are you talking about?

tarcona
07-03-2008, 07:56 AM
Yeah, but you definately need an IF statement. I want the label to CHANGE if it is a clinic or a hospital. And that is determined by a text field that says either, "IP" or "OP" (In Patient or Out Patient).

I have created two labels called lblBeds and lblProvider

If Me.txtIPOP.Value = "IP" Then
Me.lblProvider.Visible = True
Me.lblBeds.Visible = False
Else
Me.lblProvider.Visible = False
Me.lblBeds.Visible = True
End If

And that didnt work.

namliam
07-04-2008, 12:10 AM
But you allready have this If in your original code....
If Me.Out_Patient___In_Patient.Value = "IP" Then
Me.Size.Value = Provider
End If


Which is why I didnt re-add it...
The full code offcourse would need the If, but I presumed that to be known and in place.

Your visible/invisible change will work too but you need to update the form:
If Me.txtIPOP.Value = "IP" Then
Me.lblProvider.Visible = True
Me.lblBeds.Visible = False
Else
Me.lblProvider.Visible = False
Me.lblBeds.Visible = True
End If
Me.repaint '<= Update the form

To change the content of a label use:
Me.lblProvider.caption = "New text"

So
If Me.txtIPOP.Value = "IP" Then
Me.lblProvider.Caption = "Provider"
Else
Me.lblProvider.Caption = "Beds"
End If
Repainting in this case should not be needed I think, tho it is possibly needed not 100% sure on that.

tarcona
07-07-2008, 04:58 AM
Just tried this and it doesnt work. I have no clue why it wouldnt work, but it doesnt. Just curious? What EVENT do you suggest I place this code?

tarcona
07-07-2008, 08:16 AM
PROBLEM SOLVED. THANKS namliam FOR HELPING ME OUT!

namliam
07-07-2008, 12:01 PM
Could you tell us just what worked for you?? So that others finding this thread may use that solution too??