Text box question

M

Matt Muzila

I have the following code:

=[Quantity_Min] & " - " & [Quantity_Max]

It displays fine, but when the second is null, it still displays the first
and the dash. I want it to display the Min - Max if both are not null, or
display Min if the second is null. The first will never be null.
 
S

Shane S via AccessMonster.com

Hey Matt,

One thought on doing this could be:

If Trim(Nz([Quantity_Max],"")) = "" Then
=[Quantity_Min]
Else
=[Quantity_Min] & " - " & [Quantity_Max]
End If

HTH,
Shane


Matt said:
I have the following code:

=[Quantity_Min] & " - " & [Quantity_Max]

It displays fine, but when the second is null, it still displays the first
and the dash. I want it to display the Min - Max if both are not null, or
display Min if the second is null. The first will never be null.
 
M

Matt Muzila

Can this be pasted into the control source of the text box or does it have to
be implemented someway else?
 
S

Shane S via AccessMonster.com

Hey Matt,

You could probably do an IIF in the control source but honestly, I have done
very few of them so I'm not too dependable on helping you with one, but
outside of that, yes it would need to be implemented some where else.
Depends on what these fields are and what they are doing and the timing that
they are doing them in.

Shane
 
V

Van T. Dinh

Try:

= [Quantity_Min] & IIf(IsNull([Quantity_Max]), "", " - " & [Quantity_Max])
 
S

Shane S via AccessMonster.com

Hey Mr. Dinh,

Thanks for stepping in and lending a helping hand. IIF is not my strong suit.


Shane
Try:

= [Quantity_Min] & IIf(IsNull([Quantity_Max]), "", " - " & [Quantity_Max])
I have the following code:
[quoted text clipped - 3 lines]
and the dash. I want it to display the Min - Max if both are not null, or
display Min if the second is null. The first will never be null.
 
Top