Simple If Statement Dont Work!!!

DaniBoy

Registered User.
Local time
Today, 09:51
Joined
Nov 18, 2001
Messages
174
Hello Guys,
I am trying to make a lable change its caption on a Report depending on a check box, If the checkbox"REFUND" is Checked I want a label to have a caption of REFUND and if is Not Checked I want the Caption to be "CORRECTION FORM". Simple right? Well this is what I did on the OnPage Event:

Private Sub Report_Page()

If Me.Refund = True Then
Me.lblType.Caption = "Refund"
Else
Me.lblType.Caption = "Correction Form"
End If
End Sub

To things happen:

1)When the Caption on the lblType on the property sheet is blank I get a REFUND for True and Blank for False.

2)When I put CORRECTION FORM on the Caption of the lblType on the property sheet It shows the Correction Form when False and Refund when True.

I thought I had fixed the Problem, Well not quite, When I print a Report that has CORRECTION FORM on the screen, I get a REFUND on the hardcopy.

I dont know what am doing wrong, please explain to me..

Thanks
DaniBoy

PS. I did search before asking and found a post with the similar question, but it was just to make it visible or unvisible.

If(Me.Somefield=0) Then
Me.Somefield.Visible=False
Else
Me.Somefield.Visible=True
End If
in the on format event.
Or depending on the data type you could use the format option on the property sheet to set the fields fore colour to white, same thing different method.

I Dint Find any Format Event.
 
Last edited:
I just did something real similar and this might not be the best method but it works! I made 2 labels with the 2 different captions I needed..in your case Label1 = "Refund", Label2 = "Correction Form". I set both visible properties to No. I put the labels one on top of the other so that they occupy the same space. Then in the OnFormat event of the Details Section (where my labels are...if yours are in the Header use the OnFormat event of that section, etc..) I used an If statement:

If Me.Refund = True then
Me.Label1.Visible=True
Me.Label2.Visible=False
ElseIf Me.Refund = False then
Me.Label2.Visible=True
Me.Label1.Visible=False
End If

Hope this helps!
Carmen
 
Last edited:

Users who are viewing this thread

Back
Top Bottom