please help with syntax

G

Guest

I'm writing a form in Outlook 2003. The code on the form is as follows:
Sub Item_CustomPropertyChange(ByVal Name)
Set myinspector = Item.GetInspector
Set myPage1 = myInspector.ModifiedFormPages("Message")
Set Textbox1= myPage1.Controls("Textbox1")'type is Date/Time'
Set Textbox2= myPage1.Controls("Textbox2")'type is Date/Time'
Set Textbox6= myPage1.Controls("Textbox6")'type is not set, or is number'
Textbox6.value = DateDiff("d",Textbox1.value,Textbox2.value)

When i run this I get "type mismatch string:none" error on the last line,
but the code works when I fill in the boxes.
What am I doing wrong? thanks all
 
S

Sue Mosher [MVP-Outlook]

Try using CDate() to coerce each value to a date/time value. There's no guarantee that the two textboxes actually contain dates.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top