Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / June 2004

Tip: Looking for answers? Try searching our database.

Question on Coding an Outlook Form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Blue - 26 Jun 2004 02:39 GMT
Hello All,

I'm trying to make one of my textboxes visible only if a certain option
button is selected. Currently I have the textbox set to hidden in the
properties...I just don't know how to script this event in outlook...I
thought something like this would work:

If optSpecial1 = True Then
txtSpecial.Visible = True
End If

But it didn't or maybe I'm missing something...So if anyone can lead me to
the right direction that I would appreiciate it...Thank you in advance

Blue
Patricia Cardoza [Outlook MVP] - 28 Jun 2004 17:15 GMT
You're close.

If you want this text box to show or hide based on a change to a value on a
form, you'll need to use the Custom Property Change event.

Sub Item_CustomPropertyChange (ByVal Name)

Select Case Name
   Case "NameOfField"
       If Item.userProperties.Find("NameOfField").Value = "X" then

Item.ModifiedFormPages("PageName").Controls("ControlName").Visible = 0
       End If
End Select

End Sub

This sub is pretty strict about how it's configured. Don't change the word
Name in the opening line of the sub or the opening line of the Select Case
statement.

Signature

Patricia Cardoza
Outlook MVP
Author - Special Edition Using Microsoft Office Outlook 2003
Lead Author - Access 2003 VBA Programmer's Reference
Author - Absolute Beginner's Guide to Microsoft OneNote 2003

http://blogs.officezealot.com/cardoza

> Hello All,
>
[quoted text clipped - 11 lines]
>
> Blue
Blue - 28 Jun 2004 19:41 GMT
Patricia thank you for the reply...Over the weekend, after trying many different things I got this to work a different way than you did (On Outlook 2000, but for some reason 2003 it didn't work)...The way I used is below:

Dim txtSpecial
Dim txtHowMany
Dim mobjOptButControls

Function Item_Open()

Dim objInsp
Set objInsp = Item.GetInspector

' set controls collection(s) and unbound text boxes
Set mobjOptButControls = objInsp.ModifiedFormPages("Message").Controls
Set txtSpecial = mobjOptButControls("txtSpecial")
Set txtHowMany = mobjOptButControls("txtHowMany")

Set objInsp = Nothing

End Function

Sub optSpecial1_Click()
txtSpecial.Visible = True
mobjOptButControls("txtSpecial").Text = ""
End Sub

Sub OptSpecial2_Click()
txtSpecial.Visible = False
End Sub

Sub optExtra1_Click()
txtHowMany.Visible = True
mobjOptButControls("txtHowMany").Text = ""
End Sub

Sub optExtra2_Click()
txtHowMany.Visible = False
End Sub

Do you have any idea why the above code isn't working in Outlook 2003?  Also the code you posted...I was reading somewhere that you only have to use PropertyChange when a control is connect to a database...Is there any truth to that?

> You're close.
>
[quoted text clipped - 32 lines]
> >
> > Blue
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.