X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
   Reply to this topicStart new topic
> Hide Text Box Control on Continuous Form if Is Null    
 
   
snsd
post Jul 7 2005, 12:51 PM
Post#1


UtterAccess Veteran
Posts: 458
Joined: 23-November 04
From: Markham, Ontario, Canada


Hi:
I have a Single Form with the following code on the On Current event which displays the label and the text box if the text box is not null. It works perfectly.
Me.lblPendingPurchaseDueDate.Visible = IIf(IsNull(Me.txtPendingPurchaseDueDate), False, True)
I have a continuous form where I want to do the very same thing. I've tried using the same code but it doesn't work.
I've also tried:
CODE
Private Sub Form_Current()
If IsNull(Me.txtPendingPurchaseDueDate) Then
    Me.lblPendingPurchaseDueDate.Visible = False
End If
End Sub

I'm assuming different code is required for continuous forms. Please let me know what I need to do hide the label and corresponding text box on a continuous form if the text box is null.
Thanks in advance for any help you might be able to give.
Dave
Go to the top of the page
 
quest4
post Jul 7 2005, 01:29 PM
Post#2


UtterAccess Ruler
Posts: 1,884
Joined: 4-September 03
From: Cleveland, OH


Continuous forms are different animals, and I have not worked alot with them. You might wqant to trythis line instead:
If Len(Nz(Me.txtPendingPurchaseDueDate, "")) = 0 Then
Me.lblPendingPurchaseDueDate.Visible = False
End If
hth.
Go to the top of the page
 
snsd
post Jul 7 2005, 01:42 PM
Post#3


UtterAccess Veteran
Posts: 458
Joined: 23-November 04
From: Markham, Ontario, Canada


Thanks for the response. I tried it on various events including Load, On Current and Before Update, and unfortunately it didnt' work.
ave
Go to the top of the page
 
LPJohnson
post Jul 7 2005, 02:13 PM
Post#4


UtterAccess Addict
Posts: 243
Joined: 23-May 03
From: South Carolina


Use conditional formatting for the field to change the background and text color from windows background (-2147483633) to a visible color if there is a value in the field.
For your label, you'll have to replace it with an unbound text box and have it's default value set to whatever your label caption was. Use the Conditional Formatting 'Expression Is', referencing the bound field is null to show/hide it.
1.) Set the field's normal background and text color to -2147483633 or whatever color your form's background is.
2.) Conditional formatting is in the dropdown menu: Format => Conditional Formatting. Make sure you have the field selected when you open the menu item. Use "'If Field Value" is "equal to" null then...change the formatting/color to whatever.
Regards,
Larry J
Go to the top of the page
 
snsd
post Jul 7 2005, 02:31 PM
Post#5


UtterAccess Veteran
Posts: 458
Joined: 23-November 04
From: Markham, Ontario, Canada


Thanks Larry. I know that you can't use conditional formatting on a label - but never thought of replacing the label with an unbound text box to achieve the same effect.
ave
thanks.gif
Go to the top of the page
 
LPJohnson
post Jul 7 2005, 03:15 PM
Post#6


UtterAccess Addict
Posts: 243
Joined: 23-May 03
From: South Carolina


You're welcome.
If you want to do advanced stuff with formatting continuous forms, download the sample database from Lebans website.
Regards,
Larry J
Go to the top of the page
 
strohtm
post Jan 17 2014, 10:20 AM
Post#7


New Member
Posts: 7
Joined: 22-January 04



Since this is an old post is it still the best way? Has anyone figured out a way to do this in VB?
got this method to work but I know next year when I have to work on the database I'll forget all about it. Or if someone else has to work on the database they'll never think to look at conditional formatting.
Go to the top of the page
 
theDBguy
post Jan 17 2014, 11:21 AM
Post#8


Access Wiki and Forums Moderator
Posts: 60,222
Joined: 19-June 07
From: SoCal, USA


Hi,
welcome2UA.gif
Unfortunately, continuous forms still behave the same way today. However, Access can now have up to 50 conditions when using Conditional Formatting.
Go to the top of the page
 


RSSSearch   Top   Lo-Fi    26th January 2015 - 07:24 AM