| Home | Forums | Reviews | Articles | Register |
![]() |
| Thread Tools | Rate Thread |
|
|
|
| |
|
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
|
Try setting the value of the DTPicker control when the form loads:
Function Item_Open() Set objDTP = Item.GetInspector.ModifiedFormPages("P.2").Controls("DTPicker1") objDTP.Value = Date() End Function -- Eric Legault - B.A, MCP, MCSD, Outlook MVP -------------------------------------------------- {Private e-mails ignored} Job: http://www.imaginets.com Blog: http://blogs.officezealot.com/legault/ "snsd" wrote: > I am using DTPicker in a custom Task form and have it bound to the DueDate > field. I have the initial value of the control set to Date()+1. It seems to > be working fairly well. However, when I click on the drop-down arrow to open > the DTPicker calendar GUI, the highlighted value is the date I CREATED the > control versus TODAY's date. This wasn't a big deal when we were in the month > of April - the month I set-up the form - but now my users must always click > on the next month arrow to get to the month of May. Is there any way to have > the defaulted value within the DTPicker GUI (versus the control) highlight > today's date versus the date the control was created on? Thanks in advance > for any insight you might be able to share. > > Dave |
|
||
|
||||
|
=?Utf-8?B?c25zZA==?=
Guest
Posts: n/a
|
Eric: Thank-you so much for your response.
I'm pretty much a newbie and wanted to ask one point of clarification: Do I just copy your code into the VB Script Editor behind the form? (I changed "P.2" to my page name and "DTPicker1" to my control name.) I just want to make sure I do it in VBScript and not in VBA. (Ideally, I'd like to keep it in the form vs. VBA if possible.) I have copied it into the VB Script Editor and it seems to run fine - but I won't be able to "see" if it works until tomorrow after the date changes! Hoping to hear back from you. Dave "Eric Legault [MVP - Outlook]" wrote: > Try setting the value of the DTPicker control when the form loads: > > Function Item_Open() > Set objDTP = Item.GetInspector.ModifiedFormPages("P.2").Controls("DTPicker1") > objDTP.Value = Date() > End Function > > -- > Eric Legault - B.A, MCP, MCSD, Outlook MVP > -------------------------------------------------- > {Private e-mails ignored} > Job: http://www.imaginets.com > Blog: http://blogs.officezealot.com/legault/ > > "snsd" wrote: > > > I am using DTPicker in a custom Task form and have it bound to the DueDate > > field. I have the initial value of the control set to Date()+1. It seems to > > be working fairly well. However, when I click on the drop-down arrow to open > > the DTPicker calendar GUI, the highlighted value is the date I CREATED the > > control versus TODAY's date. This wasn't a big deal when we were in the month > > of April - the month I set-up the form - but now my users must always click > > on the next month arrow to get to the month of May. Is there any way to have > > the defaulted value within the DTPicker GUI (versus the control) highlight > > today's date versus the date the control was created on? Thanks in advance > > for any insight you might be able to share. > > > > Dave |
|
||
|
||||
|
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
|
Yes, just paste into the VBScript editor. You couldn't use VBA to do this
anyway. If you want to test the control with a different date, replace the "Date()" function with a value in the format #12/31/2005#. -- Eric Legault - B.A, MCP, MCSD, Outlook MVP -------------------------------------------------- {Private e-mails ignored} Job: http://www.imaginets.com Blog: http://blogs.officezealot.com/legault/ "snsd" wrote: > Eric: Thank-you so much for your response. > > I'm pretty much a newbie and wanted to ask one point of clarification: Do I > just copy your code into the VB Script Editor behind the form? (I changed > "P.2" to my page name and "DTPicker1" to my control name.) I just want to > make sure I do it in VBScript and not in VBA. (Ideally, I'd like to keep it > in the form vs. VBA if possible.) I have copied it into the VB Script Editor > and it seems to run fine - but I won't be able to "see" if it works until > tomorrow after the date changes! > > Hoping to hear back from you. > > Dave > > "Eric Legault [MVP - Outlook]" wrote: > > > Try setting the value of the DTPicker control when the form loads: > > > > Function Item_Open() > > Set objDTP = Item.GetInspector.ModifiedFormPages("P.2").Controls("DTPicker1") > > objDTP.Value = Date() > > End Function > > > > -- > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > -------------------------------------------------- > > {Private e-mails ignored} > > Job: http://www.imaginets.com > > Blog: http://blogs.officezealot.com/legault/ > > > > "snsd" wrote: > > > > > I am using DTPicker in a custom Task form and have it bound to the DueDate > > > field. I have the initial value of the control set to Date()+1. It seems to > > > be working fairly well. However, when I click on the drop-down arrow to open > > > the DTPicker calendar GUI, the highlighted value is the date I CREATED the > > > control versus TODAY's date. This wasn't a big deal when we were in the month > > > of April - the month I set-up the form - but now my users must always click > > > on the next month arrow to get to the month of May. Is there any way to have > > > the defaulted value within the DTPicker GUI (versus the control) highlight > > > today's date versus the date the control was created on? Thanks in advance > > > for any insight you might be able to share. > > > > > > Dave |
|
||
|
||||
|
=?Utf-8?B?c25zZA==?=
Guest
Posts: n/a
|
Eric:
Thanks for the code. It appears to have solved the initial challenge of making sure that the calendar view displays “today” versus the day the form was created. However, there is something I just can’t quite understand about DTPicker and am hoping you might be able to help me with. (If you think I should start a new post, please let me know and I will do so.) Let me explain what I WANT to do and then I’ll explain what I’ve done. What I want to do - Create control bound to due date field on custom task form - Set default value of control to Date() + 1 - Allow users to change Due Date using DTPicker What I’ve done - created control (txtDueDate) bound to Due Date field - on Values tab in Properties of txtDueDate control: “Property to use” = Value (is “Value” the right property for what I’m trying to do?) “Set the initial value of this field to”: = Date() + 1 “Calculate this formula when I compose a new form” button selected - created DTPicker control (DTPickerDueDate) bound to Due Date field; All values in DTPicker are set to default values - code behind the form in VB Script (as suggested by you) to ensure that DTPicker displays today’s date and not the date the control was originally created Function Item_Open() Set objDTP = Item.GetInspector.ModifiedFormPages("Client Services Task Form").Controls("DTPickerDueDate") objDTP.Value = Date() End Function Here’s where I need some help: It appears that I need TWO controls: one for Due Date and one for DTPicker. Is that correct? The reason I believe this is the case is because if I just use the DTPicker and do not display the Due Date control, the DTPicker control will display Date() even on a (non-new) record where I may have previously set the due date to another date. i.e. create a new task; change Due Date via DTPicker control to January 31, 2006; save task; when task is opened, DTPicker control displays DATE() and NOT January 31, 2006. So, here’s what I’ve done. I’ve sized the DTPicker control so that only the drop down arrow appears and placed it beside the Due Date control. So, when the user clicks on the drop down arrow, the DTPicker calendar pops-up and they can select the date they desire. After selecting the date from the DTPicker control, the Due Date FIELD is updated appropriately, but unless another control on the form receives focus, the Due Date CONTROL does not DISPLAY the updated value. Two questions: 1) Is the way I’ve set-up the controls the best way to do so? i.e. are 2 controls necessary? 2) If “yes” to 1), what is the VB Script code I can add to the form to have the focus set to the Due Date control (txtDueDate) AFTER the user selects a date from the DTPicker control (DTPickerDueDate) so that the user can see that the Due Date has been updated without having to manually select another control? I apologize for the length of this post – but wanted to give all relevant information. Thanks in advance for any further help you might be able to give. Dave "Eric Legault [MVP - Outlook]" wrote: > Yes, just paste into the VBScript editor. You couldn't use VBA to do this > anyway. > > If you want to test the control with a different date, replace the "Date()" > function with a value in the format #12/31/2005#. > > -- > Eric Legault - B.A, MCP, MCSD, Outlook MVP > -------------------------------------------------- > {Private e-mails ignored} > Job: http://www.imaginets.com > Blog: http://blogs.officezealot.com/legault/ > > > > "snsd" wrote: > > > Eric: Thank-you so much for your response. > > > > I'm pretty much a newbie and wanted to ask one point of clarification: Do I > > just copy your code into the VB Script Editor behind the form? (I changed > > "P.2" to my page name and "DTPicker1" to my control name.) I just want to > > make sure I do it in VBScript and not in VBA. (Ideally, I'd like to keep it > > in the form vs. VBA if possible.) I have copied it into the VB Script Editor > > and it seems to run fine - but I won't be able to "see" if it works until > > tomorrow after the date changes! > > > > Hoping to hear back from you. > > > > Dave > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > Try setting the value of the DTPicker control when the form loads: > > > > > > Function Item_Open() > > > Set objDTP = Item.GetInspector.ModifiedFormPages("P.2").Controls("DTPicker1") > > > objDTP.Value = Date() > > > End Function > > > > > > -- > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > -------------------------------------------------- > > > {Private e-mails ignored} > > > Job: http://www.imaginets.com > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > "snsd" wrote: > > > > > > > I am using DTPicker in a custom Task form and have it bound to the DueDate > > > > field. I have the initial value of the control set to Date()+1. It seems to > > > > be working fairly well. However, when I click on the drop-down arrow to open > > > > the DTPicker calendar GUI, the highlighted value is the date I CREATED the > > > > control versus TODAY's date. This wasn't a big deal when we were in the month > > > > of April - the month I set-up the form - but now my users must always click > > > > on the next month arrow to get to the month of May. Is there any way to have > > > > the defaulted value within the DTPicker GUI (versus the control) highlight > > > > today's date versus the date the control was created on? Thanks in advance > > > > for any insight you might be able to share. > > > > > > > > Dave |
|
||
|
||||
|
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
|
First off, I was incorrecting in stating in my last post that you cannot
access the controls on your custom form from VBA - you indeed can by using the Inspector.GetModifiedFormPages("PAGENAME").Controls collection. Boy, you've got me quite confused. Are you just trying to set the default DueDate value on the main page to the day after when a new instance of the form is opened? If so, adding this code will do what you want, with no custom controls required: Function Item_Open() Item.DueDate = DateAdd("d", 1, Date()) End Function Why do you need a custom DTPicker control anyway when the one for DueDate is perfectly okay? Also keep in mind that if you have multiple controls bound to the same field, setting the value of the property (i.e. TaskItem.DueDate) will cause this value to appear automatically in every control that is bound to it. The same goes in reverse - changing the value in the control at run-time will cause all controls bound to that field to update with the same value. However, the DTPicker control is different - it does not automatically reflect these changes in both directions, so you have to be careful. When the user saves the item, you have to manually get the value from that control and save it to the field it is bound to. If you are tracking two different kind of dates, then you definitely need a custom field to bind one of the controls to. Does this help at all? -- Eric Legault - B.A, MCP, MCSD, Outlook MVP -------------------------------------------------- {Private e-mails ignored} Job: http://www.imaginets.com Blog: http://blogs.officezealot.com/legault/ "snsd" wrote: > Eric: > > Thanks for the code. It appears to have solved the initial challenge of > making sure that the calendar view displays “today” versus the day the form > was created. However, there is something I just can’t quite understand about > DTPicker and am hoping you might be able to help me with. (If you think I > should start a new post, please let me know and I will do so.) > > Let me explain what I WANT to do and then I’ll explain what I’ve done. > > What I want to do > - Create control bound to due date field on custom task form > - Set default value of control to Date() + 1 > - Allow users to change Due Date using DTPicker > > What I’ve done > - created control (txtDueDate) bound to Due Date field > - on Values tab in Properties of txtDueDate control: > “Property to use” = Value (is “Value” the right property for what I’m > trying to do?) > “Set the initial value of this field to”: = Date() + 1 > “Calculate this formula when I compose a new form” button selected > > - created DTPicker control (DTPickerDueDate) bound to Due Date field; All > values in > DTPicker are set to default values > > - code behind the form in VB Script (as suggested by you) to ensure that > DTPicker > displays today’s date and not the date the control was originally created > > Function Item_Open() > Set objDTP = Item.GetInspector.ModifiedFormPages("Client > Services Task > Form").Controls("DTPickerDueDate") > objDTP.Value = Date() > End Function > > Here’s where I need some help: > > It appears that I need TWO controls: one for Due Date and one for DTPicker. > Is that correct? The reason I believe this is the case is because if I just > use the DTPicker and do not display the Due Date control, the DTPicker > control will display Date() even on a (non-new) record where I may have > previously set the due date to another date. i.e. create a new task; change > Due Date via DTPicker control to January 31, 2006; save task; when task is > opened, DTPicker control displays DATE() and NOT January 31, 2006. > > So, here’s what I’ve done. I’ve sized the DTPicker control so that only the > drop down arrow appears and placed it beside the Due Date control. So, when > the user clicks on the drop down arrow, the DTPicker calendar pops-up and > they can select the date they desire. After selecting the date from the > DTPicker control, the Due Date FIELD is updated appropriately, but unless > another control on the form receives focus, the Due Date CONTROL does not > DISPLAY the updated value. > > Two questions: > > 1) Is the way I’ve set-up the controls the best way to do so? i.e. are 2 > controls necessary? > > 2) If “yes” to 1), what is the VB Script code I can add to the form to have > the focus set to the Due Date control (txtDueDate) AFTER the user selects a > date from the DTPicker control (DTPickerDueDate) so that the user can see > that the Due Date has been updated without having to manually select another > control? > > I apologize for the length of this post – but wanted to give all relevant > information. > > Thanks in advance for any further help you might be able to give. > > Dave > > > "Eric Legault [MVP - Outlook]" wrote: > > > Yes, just paste into the VBScript editor. You couldn't use VBA to do this > > anyway. > > > > If you want to test the control with a different date, replace the "Date()" > > function with a value in the format #12/31/2005#. > > > > -- > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > -------------------------------------------------- > > {Private e-mails ignored} > > Job: http://www.imaginets.com > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > "snsd" wrote: > > > > > Eric: Thank-you so much for your response. > > > > > > I'm pretty much a newbie and wanted to ask one point of clarification: Do I > > > just copy your code into the VB Script Editor behind the form? (I changed > > > "P.2" to my page name and "DTPicker1" to my control name.) I just want to > > > make sure I do it in VBScript and not in VBA. (Ideally, I'd like to keep it > > > in the form vs. VBA if possible.) I have copied it into the VB Script Editor > > > and it seems to run fine - but I won't be able to "see" if it works until > > > tomorrow after the date changes! > > > > > > Hoping to hear back from you. > > > > > > Dave > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > Try setting the value of the DTPicker control when the form loads: > > > > > > > > Function Item_Open() > > > > Set objDTP = Item.GetInspector.ModifiedFormPages("P.2").Controls("DTPicker1") > > > > objDTP.Value = Date() > > > > End Function > > > > > > > > -- > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > -------------------------------------------------- > > > > {Private e-mails ignored} > > > > Job: http://www.imaginets.com > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > "snsd" wrote: > > > > > > > > > I am using DTPicker in a custom Task form and have it bound to the DueDate > > > > > field. I have the initial value of the control set to Date()+1. It seems to > > > > > be working fairly well. However, when I click on the drop-down arrow to open > > > > > the DTPicker calendar GUI, the highlighted value is the date I CREATED the > > > > > control versus TODAY's date. This wasn't a big deal when we were in the month > > > > > of April - the month I set-up the form - but now my users must always click > > > > > on the next month arrow to get to the month of May. Is there any way to have > > > > > the defaulted value within the DTPicker GUI (versus the control) highlight > > > > > today's date versus the date the control was created on? Thanks in advance > > > > > for any insight you might be able to share. > > > > > > > > > > Dave |
|
||
|
||||
|
=?Utf-8?B?c25zZA==?=
Guest
Posts: n/a
|
Eric:
Thanks again for your response. Sorry for the confusion. It’s really simple what I’m trying to accomplish. Hopefully I can be more clear…. My users need to update a number of fields (including custom fields I've created) that are not available on Page 1 of the standard Task form. Rather than requiring them to tab to Page 2 on my custom form to update these fields, I decided to hide Page 1 and replicate the controls that we require from Page 1 onto Page 2. The ONLY control I’m having a challenge with is DTPicker. So… Bottom line: I am NOT trying to track two kinds of dates. I simply want to: 1) replicate the Due Date control including the date picker from Page 1 of the standard form onto page 2 of my custom form 2) Default the value of the Due Date control (and bound Due Date field) to Date() + 1 when a NEW instance of the form is created. I was hoping that it’s as simple as binding the DTPicker control to Due Date and setting it’s default value to Date() + 1. Unfortunately, it seems more involved than that. Hope that makes it more clear. Look forward to getting to the bottom of this. Dave "Eric Legault [MVP - Outlook]" wrote: > First off, I was incorrecting in stating in my last post that you cannot > access the controls on your custom form from VBA - you indeed can by using > the Inspector.GetModifiedFormPages("PAGENAME").Controls collection. > > Boy, you've got me quite confused. Are you just trying to set the default > DueDate value on the main page to the day after when a new instance of the > form is opened? If so, adding this code will do what you want, with no > custom controls required: > > Function Item_Open() > Item.DueDate = DateAdd("d", 1, Date()) > End Function > > Why do you need a custom DTPicker control anyway when the one for DueDate is > perfectly okay? > > Also keep in mind that if you have multiple controls bound to the same > field, setting the value of the property (i.e. TaskItem.DueDate) will cause > this value to appear automatically in every control that is bound to it. The > same goes in reverse - changing the value in the control at run-time will > cause all controls bound to that field to update with the same value. > However, the DTPicker control is different - it does not automatically > reflect these changes in both directions, so you have to be careful. When > the user saves the item, you have to manually get the value from that control > and save it to the field it is bound to. > > If you are tracking two different kind of dates, then you definitely need a > custom field to bind one of the controls to. > > Does this help at all? > > -- > Eric Legault - B.A, MCP, MCSD, Outlook MVP > -------------------------------------------------- > {Private e-mails ignored} > Job: http://www.imaginets.com > Blog: http://blogs.officezealot.com/legault/ > > > > "snsd" wrote: > > > Eric: > > > > Thanks for the code. It appears to have solved the initial challenge of > > making sure that the calendar view displays “today” versus the day the form > > was created. However, there is something I just can’t quite understand about > > DTPicker and am hoping you might be able to help me with. (If you think I > > should start a new post, please let me know and I will do so.) > > > > Let me explain what I WANT to do and then I’ll explain what I’ve done. > > > > What I want to do > > - Create control bound to due date field on custom task form > > - Set default value of control to Date() + 1 > > - Allow users to change Due Date using DTPicker > > > > What I’ve done > > - created control (txtDueDate) bound to Due Date field > > - on Values tab in Properties of txtDueDate control: > > “Property to use” = Value (is “Value” the right property for what I’m > > trying to do?) > > “Set the initial value of this field to”: = Date() + 1 > > “Calculate this formula when I compose a new form” button selected > > > > - created DTPicker control (DTPickerDueDate) bound to Due Date field; All > > values in > > DTPicker are set to default values > > > > - code behind the form in VB Script (as suggested by you) to ensure that > > DTPicker > > displays today’s date and not the date the control was originally created > > > > Function Item_Open() > > Set objDTP = Item.GetInspector.ModifiedFormPages("Client > > Services Task > > Form").Controls("DTPickerDueDate") > > objDTP.Value = Date() > > End Function > > > > Here’s where I need some help: > > > > It appears that I need TWO controls: one for Due Date and one for DTPicker. > > Is that correct? The reason I believe this is the case is because if I just > > use the DTPicker and do not display the Due Date control, the DTPicker > > control will display Date() even on a (non-new) record where I may have > > previously set the due date to another date. i.e. create a new task; change > > Due Date via DTPicker control to January 31, 2006; save task; when task is > > opened, DTPicker control displays DATE() and NOT January 31, 2006. > > > > So, here’s what I’ve done. I’ve sized the DTPicker control so that only the > > drop down arrow appears and placed it beside the Due Date control. So, when > > the user clicks on the drop down arrow, the DTPicker calendar pops-up and > > they can select the date they desire. After selecting the date from the > > DTPicker control, the Due Date FIELD is updated appropriately, but unless > > another control on the form receives focus, the Due Date CONTROL does not > > DISPLAY the updated value. > > > > Two questions: > > > > 1) Is the way I’ve set-up the controls the best way to do so? i.e. are 2 > > controls necessary? > > > > 2) If “yes” to 1), what is the VB Script code I can add to the form to have > > the focus set to the Due Date control (txtDueDate) AFTER the user selects a > > date from the DTPicker control (DTPickerDueDate) so that the user can see > > that the Due Date has been updated without having to manually select another > > control? > > > > I apologize for the length of this post – but wanted to give all relevant > > information. > > > > Thanks in advance for any further help you might be able to give. > > > > Dave > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > Yes, just paste into the VBScript editor. You couldn't use VBA to do this > > > anyway. > > > > > > If you want to test the control with a different date, replace the "Date()" > > > function with a value in the format #12/31/2005#. > > > > > > -- > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > -------------------------------------------------- > > > {Private e-mails ignored} > > > Job: http://www.imaginets.com > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > "snsd" wrote: > > > > > > > Eric: Thank-you so much for your response. > > > > > > > > I'm pretty much a newbie and wanted to ask one point of clarification: Do I > > > > just copy your code into the VB Script Editor behind the form? (I changed > > > > "P.2" to my page name and "DTPicker1" to my control name.) I just want to > > > > make sure I do it in VBScript and not in VBA. (Ideally, I'd like to keep it > > > > in the form vs. VBA if possible.) I have copied it into the VB Script Editor > > > > and it seems to run fine - but I won't be able to "see" if it works until > > > > tomorrow after the date changes! > > > > > > > > Hoping to hear back from you. > > > > > > > > Dave > > > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > > > Try setting the value of the DTPicker control when the form loads: > > > > > > > > > > Function Item_Open() > > > > > Set objDTP = Item.GetInspector.ModifiedFormPages("P.2").Controls("DTPicker1") > > > > > objDTP.Value = Date() > > > > > End Function > > > > > > > > > > -- > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > > -------------------------------------------------- > > > > > {Private e-mails ignored} > > > > > Job: http://www.imaginets.com > > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > "snsd" wrote: > > > > > > > > > > > I am using DTPicker in a custom Task form and have it bound to the DueDate > > > > > > field. I have the initial value of the control set to Date()+1. It seems to > > > > > > be working fairly well. However, when I click on the drop-down arrow to open > > > > > > the DTPicker calendar GUI, the highlighted value is the date I CREATED the > > > > > > control versus TODAY's date. This wasn't a big deal when we were in the month > > > > > > of April - the month I set-up the form - but now my users must always click > > > > > > on the next month arrow to get to the month of May. Is there any way to have > > > > > > the defaulted value within the DTPicker GUI (versus the control) highlight > > > > > > today's date versus the date the control was created on? Thanks in advance > > > > > > for any insight you might be able to share. > > > > > > > > > > > > Dave |
|
||
|
||||
|
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
Posts: n/a
|
Okay, I understand now. Try this:
Bind the DTPicker control to the DueDate field. Put this in the "Set the initial value of this field to:" box, and select "Calculate this formula when I compose a new form": DateAdd("d", 1 , date()) Now add this code behind the form: Function Item_Open() Item.Getinspector.ModifiedFormPages("P.2").Controls("DTPicker1").Value = Item.DueDate End Function Since the DTPicker1 control doesn't automatically detect the change to the DueDate field when the form opens, even when it is bound, you have to read it in manually to detect the change by the formula. You can also detect changes to intrinsic fields by trapping the field name in the Item_PropertyChange event, but this isn't fired by the application of the formula. -- Eric Legault - B.A, MCP, MCSD, Outlook MVP -------------------------------------------------- {Private e-mails ignored} Job: http://www.imaginets.com Blog: http://blogs.officezealot.com/legault/ "snsd" wrote: > Eric: > > Thanks again for your response. > > Sorry for the confusion. It’s really simple what I’m trying to accomplish. > Hopefully I can be more clear…. > > My users need to update a number of fields (including custom fields I've > created) that are not available on Page 1 of the standard Task form. Rather > than requiring them to tab to Page 2 on my custom form to update these > fields, I decided to hide Page 1 and replicate the controls that we require > from Page 1 onto Page 2. The ONLY control I’m having a challenge with is > DTPicker. So… > > Bottom line: I am NOT trying to track two kinds of dates. I simply want to: > > 1) replicate the Due Date control including the date picker from Page 1 of > the standard form onto page 2 of my custom form > 2) Default the value of the Due Date control (and bound Due Date field) to > Date() + 1 when a NEW instance of the form is created. > > I was hoping that it’s as simple as binding the DTPicker control to Due Date > and setting it’s default value to Date() + 1. Unfortunately, it seems more > involved than that. > > Hope that makes it more clear. > > Look forward to getting to the bottom of this. > > Dave > > > "Eric Legault [MVP - Outlook]" wrote: > > > First off, I was incorrecting in stating in my last post that you cannot > > access the controls on your custom form from VBA - you indeed can by using > > the Inspector.GetModifiedFormPages("PAGENAME").Controls collection. > > > > Boy, you've got me quite confused. Are you just trying to set the default > > DueDate value on the main page to the day after when a new instance of the > > form is opened? If so, adding this code will do what you want, with no > > custom controls required: > > > > Function Item_Open() > > Item.DueDate = DateAdd("d", 1, Date()) > > End Function > > > > Why do you need a custom DTPicker control anyway when the one for DueDate is > > perfectly okay? > > > > Also keep in mind that if you have multiple controls bound to the same > > field, setting the value of the property (i.e. TaskItem.DueDate) will cause > > this value to appear automatically in every control that is bound to it. The > > same goes in reverse - changing the value in the control at run-time will > > cause all controls bound to that field to update with the same value. > > However, the DTPicker control is different - it does not automatically > > reflect these changes in both directions, so you have to be careful. When > > the user saves the item, you have to manually get the value from that control > > and save it to the field it is bound to. > > > > If you are tracking two different kind of dates, then you definitely need a > > custom field to bind one of the controls to. > > > > Does this help at all? > > > > -- > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > -------------------------------------------------- > > {Private e-mails ignored} > > Job: http://www.imaginets.com > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > "snsd" wrote: > > > > > Eric: > > > > > > Thanks for the code. It appears to have solved the initial challenge of > > > making sure that the calendar view displays “today” versus the day the form > > > was created. However, there is something I just can’t quite understand about > > > DTPicker and am hoping you might be able to help me with. (If you think I > > > should start a new post, please let me know and I will do so.) > > > > > > Let me explain what I WANT to do and then I’ll explain what I’ve done. > > > > > > What I want to do > > > - Create control bound to due date field on custom task form > > > - Set default value of control to Date() + 1 > > > - Allow users to change Due Date using DTPicker > > > > > > What I’ve done > > > - created control (txtDueDate) bound to Due Date field > > > - on Values tab in Properties of txtDueDate control: > > > “Property to use” = Value (is “Value” the right property for what I’m > > > trying to do?) > > > “Set the initial value of this field to”: = Date() + 1 > > > “Calculate this formula when I compose a new form” button selected > > > > > > - created DTPicker control (DTPickerDueDate) bound to Due Date field; All > > > values in > > > DTPicker are set to default values > > > > > > - code behind the form in VB Script (as suggested by you) to ensure that > > > DTPicker > > > displays today’s date and not the date the control was originally created > > > > > > Function Item_Open() > > > Set objDTP = Item.GetInspector.ModifiedFormPages("Client > > > Services Task > > > Form").Controls("DTPickerDueDate") > > > objDTP.Value = Date() > > > End Function > > > > > > Here’s where I need some help: > > > > > > It appears that I need TWO controls: one for Due Date and one for DTPicker. > > > Is that correct? The reason I believe this is the case is because if I just > > > use the DTPicker and do not display the Due Date control, the DTPicker > > > control will display Date() even on a (non-new) record where I may have > > > previously set the due date to another date. i.e. create a new task; change > > > Due Date via DTPicker control to January 31, 2006; save task; when task is > > > opened, DTPicker control displays DATE() and NOT January 31, 2006. > > > > > > So, here’s what I’ve done. I’ve sized the DTPicker control so that only the > > > drop down arrow appears and placed it beside the Due Date control. So, when > > > the user clicks on the drop down arrow, the DTPicker calendar pops-up and > > > they can select the date they desire. After selecting the date from the > > > DTPicker control, the Due Date FIELD is updated appropriately, but unless > > > another control on the form receives focus, the Due Date CONTROL does not > > > DISPLAY the updated value. > > > > > > Two questions: > > > > > > 1) Is the way I’ve set-up the controls the best way to do so? i.e. are 2 > > > controls necessary? > > > > > > 2) If “yes” to 1), what is the VB Script code I can add to the form to have > > > the focus set to the Due Date control (txtDueDate) AFTER the user selects a > > > date from the DTPicker control (DTPickerDueDate) so that the user can see > > > that the Due Date has been updated without having to manually select another > > > control? > > > > > > I apologize for the length of this post – but wanted to give all relevant > > > information. > > > > > > Thanks in advance for any further help you might be able to give. > > > > > > Dave > > > > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > Yes, just paste into the VBScript editor. You couldn't use VBA to do this > > > > anyway. > > > > > > > > If you want to test the control with a different date, replace the "Date()" > > > > function with a value in the format #12/31/2005#. > > > > > > > > -- > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > -------------------------------------------------- > > > > {Private e-mails ignored} > > > > Job: http://www.imaginets.com > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > > > > > "snsd" wrote: > > > > > > > > > Eric: Thank-you so much for your response. > > > > > > > > > > I'm pretty much a newbie and wanted to ask one point of clarification: Do I > > > > > just copy your code into the VB Script Editor behind the form? (I changed > > > > > "P.2" to my page name and "DTPicker1" to my control name.) I just want to > > > > > make sure I do it in VBScript and not in VBA. (Ideally, I'd like to keep it > > > > > in the form vs. VBA if possible.) I have copied it into the VB Script Editor > > > > > and it seems to run fine - but I won't be able to "see" if it works until > > > > > tomorrow after the date changes! > > > > > > > > > > Hoping to hear back from you. > > > > > > > > > > Dave > > > > > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > > > > > Try setting the value of the DTPicker control when the form loads: > > > > > > > > > > > > Function Item_Open() > > > > > > Set objDTP = Item.GetInspector.ModifiedFormPages("P.2").Controls("DTPicker1") > > > > > > objDTP.Value = Date() > > > > > > End Function > > > > > > > > > > > > -- > > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > > > -------------------------------------------------- > > > > > > {Private e-mails ignored} > > > > > > Job: http://www.imaginets.com > > > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > "snsd" wrote: > > > > > > > > > > > > > I am using DTPicker in a custom Task form and have it bound to the DueDate > > > > > > > field. I have the initial value of the control set to Date()+1. It seems to > > > > > > > be working fairly well. However, when I click on the drop-down arrow to open > > > > > > > the DTPicker calendar GUI, the highlighted value is the date I CREATED the > > > > > > > control versus TODAY's date. This wasn't a big deal when we were in the month > > > > > > > of April - the month I set-up the form - but now my users must always click > > > > > > > on the next month arrow to get to the month of May. Is there any way to have > > > > > > > the defaulted value within the DTPicker GUI (versus the control) highlight > > > > > > > today's date versus the date the control was created on? Thanks in advance > > > > > > > for any insight you might be able to share. > > > > > > > > > > > > > > Dave |
|
||
|
||||
|
=?Utf-8?B?c25zZA==?=
Guest
Posts: n/a
|
Bingo!!!
Thanks Eric. I'm confident you've given me the solution I need. The only clarification I want to make (ask?) for the sake of other users perusing this post is that the "Property to Use" on the Value Table of the control's property dialogue box is "Value". (Its default value is "blank".) Thanks again for your incredible patience, fast response time, and most of all your commitment to helping me find the right solution. Till next time... Dave ![]() "Eric Legault [MVP - Outlook]" wrote: > Okay, I understand now. Try this: > > Bind the DTPicker control to the DueDate field. Put this in the "Set the > initial value of this field to:" box, and select "Calculate this formula when > I compose a new form": > > DateAdd("d", 1 , date()) > > Now add this code behind the form: > > Function Item_Open() > Item.Getinspector.ModifiedFormPages("P.2").Controls("DTPicker1").Value = > Item.DueDate > End Function > > Since the DTPicker1 control doesn't automatically detect the change to the > DueDate field when the form opens, even when it is bound, you have to read it > in manually to detect the change by the formula. You can also detect changes > to intrinsic fields by trapping the field name in the Item_PropertyChange > event, but this isn't fired by the application of the formula. > > -- > Eric Legault - B.A, MCP, MCSD, Outlook MVP > -------------------------------------------------- > {Private e-mails ignored} > Job: http://www.imaginets.com > Blog: http://blogs.officezealot.com/legault/ > > > > "snsd" wrote: > > > Eric: > > > > Thanks again for your response. > > > > Sorry for the confusion. It’s really simple what I’m trying to accomplish. > > Hopefully I can be more clear…. > > > > My users need to update a number of fields (including custom fields I've > > created) that are not available on Page 1 of the standard Task form. Rather > > than requiring them to tab to Page 2 on my custom form to update these > > fields, I decided to hide Page 1 and replicate the controls that we require > > from Page 1 onto Page 2. The ONLY control I’m having a challenge with is > > DTPicker. So… > > > > Bottom line: I am NOT trying to track two kinds of dates. I simply want to: > > > > 1) replicate the Due Date control including the date picker from Page 1 of > > the standard form onto page 2 of my custom form > > 2) Default the value of the Due Date control (and bound Due Date field) to > > Date() + 1 when a NEW instance of the form is created. > > > > I was hoping that it’s as simple as binding the DTPicker control to Due Date > > and setting it’s default value to Date() + 1. Unfortunately, it seems more > > involved than that. > > > > Hope that makes it more clear. > > > > Look forward to getting to the bottom of this. > > > > Dave > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > First off, I was incorrecting in stating in my last post that you cannot > > > access the controls on your custom form from VBA - you indeed can by using > > > the Inspector.GetModifiedFormPages("PAGENAME").Controls collection. > > > > > > Boy, you've got me quite confused. Are you just trying to set the default > > > DueDate value on the main page to the day after when a new instance of the > > > form is opened? If so, adding this code will do what you want, with no > > > custom controls required: > > > > > > Function Item_Open() > > > Item.DueDate = DateAdd("d", 1, Date()) > > > End Function > > > > > > Why do you need a custom DTPicker control anyway when the one for DueDate is > > > perfectly okay? > > > > > > Also keep in mind that if you have multiple controls bound to the same > > > field, setting the value of the property (i.e. TaskItem.DueDate) will cause > > > this value to appear automatically in every control that is bound to it. The > > > same goes in reverse - changing the value in the control at run-time will > > > cause all controls bound to that field to update with the same value. > > > However, the DTPicker control is different - it does not automatically > > > reflect these changes in both directions, so you have to be careful. When > > > the user saves the item, you have to manually get the value from that control > > > and save it to the field it is bound to. > > > > > > If you are tracking two different kind of dates, then you definitely need a > > > custom field to bind one of the controls to. > > > > > > Does this help at all? > > > > > > -- > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > -------------------------------------------------- > > > {Private e-mails ignored} > > > Job: http://www.imaginets.com > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > "snsd" wrote: > > > > > > > Eric: > > > > > > > > Thanks for the code. It appears to have solved the initial challenge of > > > > making sure that the calendar view displays “today” versus the day the form > > > > was created. However, there is something I just can’t quite understand about > > > > DTPicker and am hoping you might be able to help me with. (If you think I > > > > should start a new post, please let me know and I will do so.) > > > > > > > > Let me explain what I WANT to do and then I’ll explain what I’ve done. > > > > > > > > What I want to do > > > > - Create control bound to due date field on custom task form > > > > - Set default value of control to Date() + 1 > > > > - Allow users to change Due Date using DTPicker > > > > > > > > What I’ve done > > > > - created control (txtDueDate) bound to Due Date field > > > > - on Values tab in Properties of txtDueDate control: > > > > “Property to use” = Value (is “Value” the right property for what I’m > > > > trying to do?) > > > > “Set the initial value of this field to”: = Date() + 1 > > > > “Calculate this formula when I compose a new form” button selected > > > > > > > > - created DTPicker control (DTPickerDueDate) bound to Due Date field; All > > > > values in > > > > DTPicker are set to default values > > > > > > > > - code behind the form in VB Script (as suggested by you) to ensure that > > > > DTPicker > > > > displays today’s date and not the date the control was originally created > > > > > > > > Function Item_Open() > > > > Set objDTP = Item.GetInspector.ModifiedFormPages("Client > > > > Services Task > > > > Form").Controls("DTPickerDueDate") > > > > objDTP.Value = Date() > > > > End Function > > > > > > > > Here’s where I need some help: > > > > > > > > It appears that I need TWO controls: one for Due Date and one for DTPicker. > > > > Is that correct? The reason I believe this is the case is because if I just > > > > use the DTPicker and do not display the Due Date control, the DTPicker > > > > control will display Date() even on a (non-new) record where I may have > > > > previously set the due date to another date. i.e. create a new task; change > > > > Due Date via DTPicker control to January 31, 2006; save task; when task is > > > > opened, DTPicker control displays DATE() and NOT January 31, 2006. > > > > > > > > So, here’s what I’ve done. I’ve sized the DTPicker control so that only the > > > > drop down arrow appears and placed it beside the Due Date control. So, when > > > > the user clicks on the drop down arrow, the DTPicker calendar pops-up and > > > > they can select the date they desire. After selecting the date from the > > > > DTPicker control, the Due Date FIELD is updated appropriately, but unless > > > > another control on the form receives focus, the Due Date CONTROL does not > > > > DISPLAY the updated value. > > > > > > > > Two questions: > > > > > > > > 1) Is the way I’ve set-up the controls the best way to do so? i.e. are 2 > > > > controls necessary? > > > > > > > > 2) If “yes” to 1), what is the VB Script code I can add to the form to have > > > > the focus set to the Due Date control (txtDueDate) AFTER the user selects a > > > > date from the DTPicker control (DTPickerDueDate) so that the user can see > > > > that the Due Date has been updated without having to manually select another > > > > control? > > > > > > > > I apologize for the length of this post – but wanted to give all relevant > > > > information. > > > > > > > > Thanks in advance for any further help you might be able to give. > > > > > > > > Dave > > > > > > > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > > > Yes, just paste into the VBScript editor. You couldn't use VBA to do this > > > > > anyway. > > > > > > > > > > If you want to test the control with a different date, replace the "Date()" > > > > > function with a value in the format #12/31/2005#. > > > > > > > > > > -- > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > > -------------------------------------------------- > > > > > {Private e-mails ignored} > > > > > Job: http://www.imaginets.com > > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > > > > > > > > > "snsd" wrote: > > > > > > > > > > > Eric: Thank-you so much for your response. > > > > > > > > > > > > I'm pretty much a newbie and wanted to ask one point of clarification: Do I > > > > > > just copy your code into the VB Script Editor behind the form? (I changed > > > > > > "P.2" to my page name and "DTPicker1" to my control name.) I just want to > > > > > > make sure I do it in VBScript and not in VBA. (Ideally, I'd like to keep it > > > > > > in the form vs. VBA if possible.) I have copied it into the VB Script Editor > > > > > > and it seems to run fine - but I won't be able to "see" if it works until > > > > > > tomorrow after the date changes! > > > > > > > > > > > > Hoping to hear back from you. > > > > > > > > > > > > Dave > > > > > > > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > > > > > > > Try setting the value of the DTPicker control when the form loads: > > > > > > > > > > > > > > Function Item_Open() > > > > > > > Set objDTP = Item.GetInspector.ModifiedFormPages("P.2").Controls("DTPicker1") > > > > > > > objDTP.Value = Date() > > > > > > > End Function > > > > > > > > > > > > > > -- > > > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > > > > -------------------------------------------------- > > > > > > > {Private e-mails ignored} > > > > > > > Job: http://www.imaginets.com > > > > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > > > "snsd" wrote: > > > > > > > > > > > > > > > I am using DTPicker in a custom Task form and have it bound to the DueDate > > > > > > > > field. I have the initial value of the control set to Date()+1. It seems to > > > > > > > > be working fairly well. However, when I click on the drop-down arrow to open > > > > > > > > the DTPicker calendar GUI, the highlighted value is the date I CREATED the > > > > > > > > control versus TODAY's date. This wasn't a big deal when we were in the month > > > > > > > > of April - the month I set-up the form - but now my users must always click > > > > > > > > on the next month arrow to get to the month of May. Is there any way to have > > > > > > > > the defaulted value within the DTPicker GUI (versus the control) highlight > > > > > > > > today's date versus the date the control was created on? Thanks in advance > > > > > > > > for any insight you might be able to share. > > > > > > > > > > > > > > > > Dave |
|
||
|
||||
|
=?Utf-8?B?c25zZA==?=
Guest
Posts: n/a
|
Eric:
OK. One small hitch that I'm assuming just requires a minimal tweak. I created a new task item using the form and saved it. When I open the item, all is fine. When I close it, it prompts me to save it even if I haven't updated any controls. What do we need to add to stop the prompt to save the item? Thanks again. Hopefully this will be my last question on this issue. Dave "snsd" wrote: > Bingo!!! > > Thanks Eric. I'm confident you've given me the solution I need. The only > clarification I want to make (ask?) for the sake of other users perusing this > post is that the "Property to Use" on the Value Table of the control's > property dialogue box is "Value". (Its default value is "blank".) > > Thanks again for your incredible patience, fast response time, and most of > all your commitment to helping me find the right solution. > > Till next time... > > Dave ![]() > > "Eric Legault [MVP - Outlook]" wrote: > > > Okay, I understand now. Try this: > > > > Bind the DTPicker control to the DueDate field. Put this in the "Set the > > initial value of this field to:" box, and select "Calculate this formula when > > I compose a new form": > > > > DateAdd("d", 1 , date()) > > > > Now add this code behind the form: > > > > Function Item_Open() > > Item.Getinspector.ModifiedFormPages("P.2").Controls("DTPicker1").Value = > > Item.DueDate > > End Function > > > > Since the DTPicker1 control doesn't automatically detect the change to the > > DueDate field when the form opens, even when it is bound, you have to read it > > in manually to detect the change by the formula. You can also detect changes > > to intrinsic fields by trapping the field name in the Item_PropertyChange > > event, but this isn't fired by the application of the formula. > > > > -- > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > -------------------------------------------------- > > {Private e-mails ignored} > > Job: http://www.imaginets.com > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > "snsd" wrote: > > > > > Eric: > > > > > > Thanks again for your response. > > > > > > Sorry for the confusion. It’s really simple what I’m trying to accomplish. > > > Hopefully I can be more clear…. > > > > > > My users need to update a number of fields (including custom fields I've > > > created) that are not available on Page 1 of the standard Task form. Rather > > > than requiring them to tab to Page 2 on my custom form to update these > > > fields, I decided to hide Page 1 and replicate the controls that we require > > > from Page 1 onto Page 2. The ONLY control I’m having a challenge with is > > > DTPicker. So… > > > > > > Bottom line: I am NOT trying to track two kinds of dates. I simply want to: > > > > > > 1) replicate the Due Date control including the date picker from Page 1 of > > > the standard form onto page 2 of my custom form > > > 2) Default the value of the Due Date control (and bound Due Date field) to > > > Date() + 1 when a NEW instance of the form is created. > > > > > > I was hoping that it’s as simple as binding the DTPicker control to Due Date > > > and setting it’s default value to Date() + 1. Unfortunately, it seems more > > > involved than that. > > > > > > Hope that makes it more clear. > > > > > > Look forward to getting to the bottom of this. > > > > > > Dave > > > > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > First off, I was incorrecting in stating in my last post that you cannot > > > > access the controls on your custom form from VBA - you indeed can by using > > > > the Inspector.GetModifiedFormPages("PAGENAME").Controls collection. > > > > > > > > Boy, you've got me quite confused. Are you just trying to set the default > > > > DueDate value on the main page to the day after when a new instance of the > > > > form is opened? If so, adding this code will do what you want, with no > > > > custom controls required: > > > > > > > > Function Item_Open() > > > > Item.DueDate = DateAdd("d", 1, Date()) > > > > End Function > > > > > > > > Why do you need a custom DTPicker control anyway when the one for DueDate is > > > > perfectly okay? > > > > > > > > Also keep in mind that if you have multiple controls bound to the same > > > > field, setting the value of the property (i.e. TaskItem.DueDate) will cause > > > > this value to appear automatically in every control that is bound to it. The > > > > same goes in reverse - changing the value in the control at run-time will > > > > cause all controls bound to that field to update with the same value. > > > > However, the DTPicker control is different - it does not automatically > > > > reflect these changes in both directions, so you have to be careful. When > > > > the user saves the item, you have to manually get the value from that control > > > > and save it to the field it is bound to. > > > > > > > > If you are tracking two different kind of dates, then you definitely need a > > > > custom field to bind one of the controls to. > > > > > > > > Does this help at all? > > > > > > > > -- > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > -------------------------------------------------- > > > > {Private e-mails ignored} > > > > Job: http://www.imaginets.com > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > > > > > "snsd" wrote: > > > > > > > > > Eric: > > > > > > > > > > Thanks for the code. It appears to have solved the initial challenge of > > > > > making sure that the calendar view displays “today” versus the day the form > > > > > was created. However, there is something I just can’t quite understand about > > > > > DTPicker and am hoping you might be able to help me with. (If you think I > > > > > should start a new post, please let me know and I will do so.) > > > > > > > > > > Let me explain what I WANT to do and then I’ll explain what I’ve done. > > > > > > > > > > What I want to do > > > > > - Create control bound to due date field on custom task form > > > > > - Set default value of control to Date() + 1 > > > > > - Allow users to change Due Date using DTPicker > > > > > > > > > > What I’ve done > > > > > - created control (txtDueDate) bound to Due Date field > > > > > - on Values tab in Properties of txtDueDate control: > > > > > “Property to use” = Value (is “Value” the right property for what I’m > > > > > trying to do?) > > > > > “Set the initial value of this field to”: = Date() + 1 > > > > > “Calculate this formula when I compose a new form” button selected > > > > > > > > > > - created DTPicker control (DTPickerDueDate) bound to Due Date field; All > > > > > values in > > > > > DTPicker are set to default values > > > > > > > > > > - code behind the form in VB Script (as suggested by you) to ensure that > > > > > DTPicker > > > > > displays today’s date and not the date the control was originally created > > > > > > > > > > Function Item_Open() > > > > > Set objDTP = Item.GetInspector.ModifiedFormPages("Client > > > > > Services Task > > > > > Form").Controls("DTPickerDueDate") > > > > > objDTP.Value = Date() > > > > > End Function > > > > > > > > > > Here’s where I need some help: > > > > > > > > > > It appears that I need TWO controls: one for Due Date and one for DTPicker. > > > > > Is that correct? The reason I believe this is the case is because if I just > > > > > use the DTPicker and do not display the Due Date control, the DTPicker > > > > > control will display Date() even on a (non-new) record where I may have > > > > > previously set the due date to another date. i.e. create a new task; change > > > > > Due Date via DTPicker control to January 31, 2006; save task; when task is > > > > > opened, DTPicker control displays DATE() and NOT January 31, 2006. > > > > > > > > > > So, here’s what I’ve done. I’ve sized the DTPicker control so that only the > > > > > drop down arrow appears and placed it beside the Due Date control. So, when > > > > > the user clicks on the drop down arrow, the DTPicker calendar pops-up and > > > > > they can select the date they desire. After selecting the date from the > > > > > DTPicker control, the Due Date FIELD is updated appropriately, but unless > > > > > another control on the form receives focus, the Due Date CONTROL does not > > > > > DISPLAY the updated value. > > > > > > > > > > Two questions: > > > > > > > > > > 1) Is the way I’ve set-up the controls the best way to do so? i.e. are 2 > > > > > controls necessary? > > > > > > > > > > 2) If “yes” to 1), what is the VB Script code I can add to the form to have > > > > > the focus set to the Due Date control (txtDueDate) AFTER the user selects a > > > > > date from the DTPicker control (DTPickerDueDate) so that the user can see > > > > > that the Due Date has been updated without having to manually select another > > > > > control? > > > > > > > > > > I apologize for the length of this post – but wanted to give all relevant > > > > > information. > > > > > > > > > > Thanks in advance for any further help you might be able to give. > > > > > > > > > > Dave > > > > > > > > > > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > > > > > Yes, just paste into the VBScript editor. You couldn't use VBA to do this > > > > > > anyway. > > > > > > > > > > > > If you want to test the control with a different date, replace the "Date()" > > > > > > function with a value in the format #12/31/2005#. > > > > > > > > > > > > -- > > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > > > -------------------------------------------------- > > > > > > {Private e-mails ignored} > > > > > > Job: http://www.imaginets.com > > > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > > > > > > > > > > > > > "snsd" wrote: > > > > > > > > > > > > > Eric: Thank-you so much for your response. > > > > > > > > > > > > > > I'm pretty much a newbie and wanted to ask one point of clarification: Do I > > > > > > > just copy your code into the VB Script Editor behind the form? (I changed > > > > > > > "P.2" to my page name and "DTPicker1" to my control name.) I just want to > > > > > > > make sure I do it in VBScript and not in VBA. (Ideally, I'd like to keep it > > > > > > > in the form vs. VBA if possible.) I have copied it into the VB Script Editor > > > > > > > and it seems to run fine - but I won't be able to "see" if it works until > > > > > > > tomorrow after the date changes! > > > > > > > > > > > > > > Hoping to hear back from you. > > > > > > > > > > > > > > Dave > > > > > > > > > > > > > > "Eric Legault [MVP - Outlook]" wrote: > > > > > > > > > > > > > > > Try setting the value of the DTPicker control when the form loads: > > > > > > > > > > > > > > > > Function Item_Open() > > > > > > > > Set objDTP = Item.GetInspector.ModifiedFormPages("P.2").Controls("DTPicker1") > > > > > > > > objDTP.Value = Date() > > > > > > > > End Function > > > > > > > > > > > > > > > > -- > > > > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP > > > > > > > > -------------------------------------------------- > > > > > > > > {Private e-mails ignored} > > > > > > > > Job: http://www.imaginets.com > > > > > > > > Blog: http://blogs.officezealot.com/legault/ > > > > > > > > > > > > > > > > "snsd" wrote: > > > > > > > > > > > > > > > > > I am using DTPicker in a custom Task form and have it bound to the DueDate > > > > > > > > > field. I have the initial value of the control set to Date()+1. It seems to > > > > > > > > > be working fairly well. However, when I click on the drop-down arrow to open > > > > > > > > > the DTPicker calendar GUI, the highlighted value is the date I CREATED the > > > > > > > > > control versus TODAY's date. This wasn't a big deal when we were in the month > > > > > > > > > of April - the month I set-up the form - but now my users must always click > > > > > > > > > on the next month arrow to get to the month of May. Is there any way to have > > > > > > > > > the defaulted value within the DTPicker GUI (versus the control) highlight > > > > > > > > > today's date versus the date the control was created on? Thanks in advance > > > > > > > > > for any insight you might be able to share. > > > > > > > > > > > > > > > > > > Dave |
|
||
|
||||
|
|
|
| |
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| remove "date created" from "all access objects" | derylmek | Microsoft Access | 1 | 13th Oct 2009 07:38 PM |
| HELP!!! "find now" is changing my view from "day/week/month" to"Active Appointments" | johng34 | Microsoft Outlook Calendar | 1 | 12th Jun 2009 03:31 AM |
| Display a "Date" or "Month" or "Year" in a report | Larry | Microsoft Access Reports | 2 | 6th Aug 2008 10:55 PM |
| Journal "Start Date" and "Entry Created Date" | =?Utf-8?B?am9lbWNl?= | Microsoft Outlook Contacts | 0 | 1st Aug 2006 07:33 PM |
| Details in files and folders: "Date Created"," Date Modified" | DiamondIM | Windows XP Basics | 1 | 27th Aug 2003 11:19 AM |
Powered by vBulletin®. Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2010, Crawlability, Inc. |




