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 / General MS InfoPath Questions / November 2005

Tip: Looking for answers? Try searching our database.

reference a field for Date in objAppointment.Start

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
obespalov@gmail.com - 04 Nov 2005 17:17 GMT
How do I reference a text or date picker field for objAppointment.Start
part of the script?

Const olAppointmentItem = 1

Set objOutlook = CreateObject("Outlook.Application")

Set objAppointment = objOutlook.CreateItem(olAppointmentItem)

[b]objAppointment.Start = #11/3/2005 11:00 AM#

objAppointment.Duration = 60

objAppointment.Subject = "Complete Applicant Review"

objAppointment.Body = "Make sure all feedback is complete and create
feedback summary."

objAppointment.Location = ""

objAppointment.ReminderMinutesBeforeStart = 15

objAppointment.ReminderSet = True



objAppointment.Save
Franck Dauché - 04 Nov 2005 17:55 GMT
Hi,

Your need to point to the node associated with your Date Picker and convert
the ISO8601 Date by scripting.

In JScript for example, it would be:

var date1 = XDocument.DOM.selectSingleNode( "//my:field1" ).text;
var dt1 = ISO8601ToDate(date1);
// dt1 can then be used as a regular date
function ISO8601ToDate(dateString)
{return new Date(dateString.split('-').reverse().join('/')) }

Hope that it helps.

Regards,

Franck Dauché

> How do I reference a text or date picker field for objAppointment.Start
> part of the script?
[quoted text clipped - 23 lines]
>
> objAppointment.Save
obespalov@gmail.com - 04 Nov 2005 18:10 GMT
Thanks for both responses.  I'm not sure in which forum to respond back
so I'll try here first.

Would you know by any chance how to do this in VB script?
Franck Dauché - 04 Nov 2005 18:49 GMT
Hi,

Look at this, it should get your started:
http://www.merlyn.demon.co.uk/vb-dates.htm#IF

Regards,

Franck Dauché

> Thanks for both responses.  I'm not sure in which forum to respond back
> so I'll try here first.
>
> Would you know by any chance how to do this in VB script?
obespalov@gmail.com - 04 Nov 2005 18:58 GMT
(Also posted in the other forum by accident)
Thanks, I got the code to work (below). Would you know the statement to
use to add 1 week to whatever date it's referencing in the field?

Dim objField

Set objField =
XDocument.DOM.selectSingleNode("//my:myFields/my:Date_Interview")

Const olAppointmentItem = 1

Set objOutlook = CreateObject("Outlook.Application")

Set objAppointment = objOutlook.CreateItem(olAppointmentItem)

dim theDate

theDate = objField.text & " 9:00 AM"

objAppointment.Start = theDate

objAppointment.Duration = 60

objAppointment.Subject = "Complete Applicant Review"

objAppointment.Body = "Make sure all feedback is complete and create
feedback summary."

objAppointment.Location = ""

objAppointment.ReminderMinutesBeforeStart = 15

objAppointment.ReminderSet = True

objAppointment.Save

End Sub
Franck Dauché - 04 Nov 2005 20:17 GMT
Hi,

You had 2 parts to your original question:
How to get your date from a textbox or from a Date Picker.

To do any date manipulation, you need to turn your node content into a date.
Starting from a string (which is what you now decided to do) is easier.  
From a date picker, you will need that extra ISO 8601 conversion.

At the end of the day, it is the same date manipulation in VBScript (see the
link in my previous post).

Hope that it helps.

Regards,

Franck Dauché

> (Also posted in the other forum by accident)
> Thanks, I got the code to work (below). Would you know the statement to
[quoted text clipped - 33 lines]
>
> End Sub
obespalov@gmail.com - 04 Nov 2005 22:03 GMT
Finally, here is the solution.  I am posting here for others searching
in the future...

Dim objField

Set objField =
XDocument.DOM.selectSingleNode("//my:myFields/my:Date_Interview")

       if objField.text <> "" then

               Const olAppointmentItem = 1

               Set objOutlook = CreateObject("Outlook.Application")

               Set objAppointment =
objOutlook.CreateItem(olAppointmentItem)

               dim theDate

               theDate = objField.text

               theDate = DateAdd("D", 7, theDate)

               theDate = theDate & " 9:00 AM"

               objAppointment.Start = theDate

               objAppointment.Duration = 60

               objAppointment.Subject = "Complete Applicant Review"

               objAppointment.Body = "Make sure all feedback is
complete and create feedback summary."

               objAppointment.Location = ""

               objAppointment.ReminderMinutesBeforeStart = 15

               objAppointment.ReminderSet = True

               objAppointment.Save

       End if
 
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.