Report Issue

ramez75

Registered User.
Local time
Today, 03:21
Joined
Dec 23, 2008
Messages
181
Hi,

I have a weird issue happening and I cant get aound it because it doesnt make sense.

For the sake of simplicity. I have a report with one field (Date type). Also I have to fields on top of each other one is a Label and the other is a textfield

My intention is if the Date field has a date then make the textfield invisible and the label field visible and vice versa.

It seemed straight forward...........I dont even get any errors but nothing works

What I did is under the report OnCurrent Event and put the below. The textfield (visible = No) and Labelfield (visible=No). dateresponded (date/Short date)

Code:
Private Sub Report_Current()
If IsNull(Me![dateresponded]) Or (Me![dateresponded]) = "" Then
ME.Labelfield.Visible = True
Me.Textfield.Visible = False
Elseif (Me![dateresponded]) <> "" Then
ME.Labelfield.Visible = False
Me.Textfield.Visible = True
End If
End Sub

I dont see what is wrong. I tried using the On Activate and On Load events command but I get an error 2427.

I also tried dateresponded.value and dateresponded.text

Any feedback will be greatly appreciated
 
You need to put the code on the FORMAT event of the section where the controls are located.
 
You need to put the code on the FORMAT event of the section where the controls are located.

Thanks thats what I actually ended up going with. A question though why the On current event wont work.
 
A question though why the On current event wont work.

The current event doesn't go through all records and do what needs to be done. It only will handle the first state of something when opened or when you click through it. The Format event of the section happens before the report is displayed and it does it for every record.
 
The current event doesn't go through all records and do what needs to be done. It only will handle the first state of something when opened or when you click through it. The Format event of the section happens before the report is displayed and it does it for every record.


Thank you learned something new today.............The way I figured out the Format event is I tried most of the events at lunch break and the "Format event" worked and then I say your response

Thank you again
 

Users who are viewing this thread

Back
Top Bottom