My Assistant
![]() ![]() |
|
|
Apr 17 2012, 12:47 PM
Post
#1
|
|
|
UtterAccess Ruler Posts: 4,237 From: Downey, CA |
I have a text box named Start_Date I want to hide if the value in my visible=false text box is "Today" that's literally a text string "Today" but these do NOT work:
CODE Me.End_Date.Visible = IIf(Me.St_Date = "*today*", False, True) CODE Me.End_Date.Visible = IIf(Me.St_Date = "today", False, True) edit: Ooops, sorry, there is a text box named End_Date I want to hide if the value in Start_date contains the text string "Today" ... don't know if I made that perfectly clear. Any help would be greatly appreciated ... This post has been edited by bakersburg9: Apr 17 2012, 12:49 PM |
|
|
|
Apr 17 2012, 01:00 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 9,272 From: Wisconsin |
bakersburg9,
Which form/control event contains this VBA code? (When does it fire?) Have you tried this: Me.End_Date.Visible = Not(Me.St_Date = "today") Hope this helps, Dennis |
|
|
|
Apr 17 2012, 01:01 PM
Post
#3
|
|
|
Access Wiki and Forums Moderator Posts: 47,940 From: SoCal, USA |
Hi Steve,
Does this work? Me.End_Date.Visible = Not (Me.St_Date="today") Just my 2 cents... (IMG:style_emoticons/default/2cents.gif) EDIT: Oops, too slow. Sorry... (IMG:style_emoticons/default/blush.gif) This post has been edited by theDBguy: Apr 17 2012, 01:02 PM |
|
|
|
Apr 17 2012, 01:08 PM
Post
#4
|
|
|
UtterAccess Ruler Posts: 4,237 From: Downey, CA |
|
|
|
|
Apr 17 2012, 01:34 PM
Post
#5
|
|
|
UtterAccess VIP Posts: 9,272 From: Wisconsin |
bakersburg,
The problem is that the Open event only fires once - when the form opens. You should probably move the code to the AfterUpdate event of the St_Date, and then include a call to run St_Date_AfterUpdate in the form's OnCurrent event. That way it will fire when the textbox value changes, or when the user navigates to a different record. Hope this helps, Dennis |
|
|
|
Apr 17 2012, 01:48 PM
Post
#6
|
|
|
UtterAccess Ruler Posts: 4,237 From: Downey, CA |
The problem is that the Open event only fires once - when the form opens. QUOTE You should probably move the code to the AfterUpdate event of the St_Date **scree-e-e-e-e-ch !!! ** problem - that's not an option - I don't think these are: On Click On Got Focus On Lost Focus On Dbl Click On Mouse Down On Mouse Up On Mouse Move On Key Down On Key Up On Key Press On Enter On Exit |
|
|
|
Apr 17 2012, 02:11 PM
Post
#7
|
|
|
UtterAccess VIP Posts: 9,272 From: Wisconsin |
bakersburg,
In your original post, you described it as a "text box" - is this not correct? If it's a label, you need to explain what causes the label to change. THAT event is where the visible/invisible code will need to go. Dennis |
|
|
|
Apr 17 2012, 02:13 PM
Post
#8
|
|
|
UtterAccess Ruler Posts: 4,237 From: Downey, CA |
In your original post, you described it as a "text box" - is this not correct? If it's a label, you need to explain what causes the label to change. THAT event is where the visible/invisible code will need to go. That's correct - it IS a text box - don't know where I said anything about a label - if I erroneously used a label, I think I'd know :-) |
|
|
|
Apr 17 2012, 02:15 PM
Post
#9
|
|
|
UtterAccess VIP Posts: 9,272 From: Wisconsin |
bakersburg,
A textbox DOES have an AfterUpdate event. It fires after the user types in a value and either hits [Enter] or leaves the control to move to another one. If that event is not available to the control, you should verify that it is a textbox by opening your form in Design View, selecting the control, and looking at the Property Sheet. The second line, right under the words "Property Sheet" should say "Selection type:" followed by the type of control you're currently selecting. Dennis |
|
|
|
Apr 17 2012, 02:49 PM
Post
#10
|
|
|
UtterAccess Ruler Posts: 4,237 From: Downey, CA |
bakersburg, A textbox DOES have an AfterUpdate event. It fires after the user types in a value and either hits [Enter] or leaves the control to move to another one. ahhhh the light bulb just went on - you are thinking this is a text box on a FORM - I have the question in the wrong forum s/b Access REPORTS - that's the problem ! |
|
|
|
Apr 17 2012, 02:55 PM
Post
#11
|
|
|
UtterAccess VIP Posts: 9,272 From: Wisconsin |
bakersburg,
That is helpful. In that case, I would use the Format event for the section where the textbox appears. That event fires once each time the section is printed. So, if the textbox is in the Detail section of the report, use the Detail section's OnFormat event. Dennis |
|
|
|
Apr 17 2012, 03:03 PM
Post
#12
|
|
|
UtterAccess Ruler Posts: 4,237 From: Downey, CA |
That is helpful. In that case, I would use the Format event for the section where the textbox appears. That event fires once each time the section is printed. So, if the textbox is in the Detail section of the report, use the Detail section's OnFormat event. Didn't work: CODE Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.End_Date.Visible = Not (Me.St_Date = "today") End Sub |
|
|
|
Apr 17 2012, 03:04 PM
Post
#13
|
|
|
UtterAccess VIP Posts: 9,272 From: Wisconsin |
bakersburg9,
QUOTE Didn't work Can you be more specific? Did you get an error message? Is the textbox always visible? Is it never visible? What? Perhaps you could put a Breakpoint on that line of code, and then when you open your report and the code pauses there, you can see the two values to see if they are comparing properly. Dennis |
|
|
|
Apr 17 2012, 03:07 PM
Post
#14
|
|
|
UtterAccess Ruler Posts: 4,237 From: Downey, CA |
if the textbox is in the Detail section of the report, use the Detail section's OnFormat event. Great news ! The advice was spot-on, it's that the code was the problem - THIS worked : CODE Me.End_Date.Visible = IIf(Me.start_date = "today", False, True) THANK YOU !!!!!! (IMG:style_emoticons/default/cool.gif) Steve |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 21st May 2013 - 02:49 AM |