dbTalk Databases Forums  

Conditionally Show Textbox

comp.databases.ms-access comp.databases.ms-access


Discuss Conditionally Show Textbox in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Cassandra
 
Posts: n/a

Default Conditionally Show Textbox - 07-29-2003 , 02:08 AM






On my invoice I show payment type 1, 2 or 3. How do I set up a textbox on the
report so it is visible when payment type is 1 and not visible when payment type
is 2 or 3?

Thanks!

Cassandra



Reply With Quote
  #2  
Old   
Allen Browne
 
Posts: n/a

Default Re: Conditionally Show Textbox - 07-29-2003 , 05:24 AM






Use the After Update event procedure of PaymentType to set the Visible
property of the text box:

Private Sub PaymentType_AfterUpdate()
Dim bShow As Boolean
If Me.[PaymentType] = 1 Then
bShow = True
Else
bShow = False
End If
If Me.[NameOfYourTextBox].Visible <> bShow Then
Me.[NameOfYourTextBox].Visible = bShow
End If
End Sub

You also need to run this code when a record loads into the form, i.e. in
the Current even of the form:
Private Sub Form_Current()
Call Sub PaymentType_AfterUpdate
End Sub

You may also want to do something similar in the Undo event of the form,
using the OldValue of PaymentType.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to the newsgroup. (Email address has spurious "_SpamTrap")

"Cassandra" <crudigear (AT) lexus (DOT) net> wrote

Quote:
On my invoice I show payment type 1, 2 or 3. How do I set up a textbox on
the
report so it is visible when payment type is 1 and not visible when
payment type
is 2 or 3?

Thanks!

Cassandra





Reply With Quote
  #3  
Old   
Allen Browne
 
Posts: n/a

Default Re: Conditionally Show Textbox - 07-29-2003 , 09:14 AM



Sorry: missed that. Fredg posted the right answer.

You could use the code I suggested in the Format event of the Detail section
of the report. It is safer (handles possible Null values) and slightly more
efficient (doesn't change the Visible property unless it needs changing).

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to the newsgroup. (Email address has spurious "_SpamTrap")

"Cassandra" <crudigear (AT) lexus (DOT) net> wrote

Quote:
Allen,

Thanks for responding! My question is about a textbox on a report!

Cassandra

"Allen Browne" <abrowne1_SpamTrap (AT) bigpond (DOT) net.au> wrote in message
news:FXrVa.21624$OM3.8265 (AT) news-server (DOT) bigpond.net.au...
Use the After Update event procedure of PaymentType to set the Visible
property of the text box:

Private Sub PaymentType_AfterUpdate()
Dim bShow As Boolean
If Me.[PaymentType] = 1 Then
bShow = True
Else
bShow = False
End If
If Me.[NameOfYourTextBox].Visible <> bShow Then
Me.[NameOfYourTextBox].Visible = bShow
End If
End Sub

You also need to run this code when a record loads into the form, i.e.
in
the Current even of the form:
Private Sub Form_Current()
Call Sub PaymentType_AfterUpdate
End Sub

You may also want to do something similar in the Undo event of the form,
using the OldValue of PaymentType.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to the newsgroup. (Email address has spurious "_SpamTrap")

"Cassandra" <crudigear (AT) lexus (DOT) net> wrote in message
news:T3pVa.26104$Mc.2027200 (AT) newsread1 (DOT) prod.itd.earthlink.net...
On my invoice I show payment type 1, 2 or 3. How do I set up a textbox
on
the
report so it is visible when payment type is 1 and not visible when
payment type
is 2 or 3?

Thanks!

Cassandra










Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.