hide text if field is null (1 Viewer)

Akai90

Member
Local time
Tomorrow, 02:03
Joined
Feb 8, 2022
Messages
65
hai

this is my current code for report access

Code:
="RM " & Format([YURANPROG1];"Standard") & " " & [yrnsujek1] &""
output : RM 50.00 / subjek
yuranprog1 = 50.00
subjek = / subjek

how can i hide "RM" if yuranprog1 and yrnsujek1 is empty or null on report

thanks
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 13:03
Joined
Feb 28, 2001
Messages
27,188
Remember that you can have Print and Format events for reports, and that the Print event ONLY fires if the report is in Print Preview mode.

You can, in the section that contains those controls, have something like:

Code:
IF NZ( yuranprog1, "" ) = "" AND NZ( yrnsujeck1, "" ) = "" THEN
    RM.Visible = FALSE
ELSE
    RM.Visible = TRUE
    RM = 50.00 / subjek
END IF

This assumes that both of those variables are STRINGS (Short or Long). If they are not, NZ is perhaps still usable but in a different format than presented here. For instance, if [yuranprog1] is actually numeric, then that would be NZ( yuranprog1, 0 ) = 0 rather than the text version. Also, if you have other things to do to RM when it is visible, they can also go in the ELSE branch of that IF statement.
 

Josef P.

Well-known member
Local time
Today, 20:03
Joined
Feb 2, 2023
Messages
826
Try this:
Code:
= Format([YURANPROG1], "\R\M #,##0.00") & (" " + [yrnsujek1])
 

Users who are viewing this thread

Top Bottom