Question HELP! Probably a simple solution....

tarcona

Registered User.
Local time
Today, 08:30
Joined
Jun 3, 2008
Messages
165
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:

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

But that is not working.
 
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.
 
You havent helped me with my problem at all....
I want my label name to change in relation to another field.
 
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?
 
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.
 
But you allready have this If in your original code....
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.
 
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?
 
PROBLEM SOLVED. THANKS namliam FOR HELPING ME OUT!
 
Could you tell us just what worked for you?? So that others finding this thread may use that solution too??
 

Users who are viewing this thread

Back
Top Bottom