Microsoft KB Archive/924727

= The date is not parsed correctly when you set the date by using a rule in InfoPath 2007 =

Article ID: 924727

Article Last Modified on 11/3/2006

-

APPLIES TO


 * Microsoft Office InfoPath 2007
 * Microsoft Office Forms Server 2007

-



SYMPTOMS
When you set a date by using a rule in Microsoft Office InfoPath 2007, the date is not parsed correctly. Additionally, the date field displays a red, dashed border that indicates that the value is not valid.



CAUSE
This behavior occurs because the date must be in the  format when you set the date by using a rule or by using code. If the date is not in this format, the date is not parsed correctly, and the date is displayed as a value that is not valid.



WORKAROUND
To work around this behavior, use a date that is in the  format when you set the rule. To do this, follow these steps:
 * 1) Start InfoPath 2007, click Design a Form Template, select Blank, and then click OK.
 * 2) Click Controls, and then add a Text Box control to the left pane. The default name of this field is field1.
 * 3) Double-click the text box, select Date (date) in the Date type drop-down list, and then click OK.
 * 4) Click the Format button.
 * 5) Select the format, for example 3/14/2001, and then click OK.
 * 6) Click OK one more time.
 * 7) Add a Button control to the left pane. The default name of this control is Button.
 * 8) Double-click Button, click Rules, and then click Add.
 * 9) Click Add Action, select Set a field's value in the drop-down list.
 * 10) Click the icon that is next to the Field text box, and then select field1.
 * 11) Type a validate format date, for example 2006-09-30, and then click OK.
 * 12) Click OK three times.
 * 13) Click Preview on the toolbar, and then click Button. You will see 9/30/2006 shown in the date field.



STATUS
This behavior is by design.



Steps to reproduce the behavior

 * 1) Start InfoPath 2007.
 * 2) Click Design a Form Template, click Blank, and then click OK.
 * 3) Click Controls, and then add a Text Box control to the left pane.

By default, the name of this control is field1.
 * 1) Double-click field1, click Date (date) in the Date type list, and then click OK.
 * 2) Add a Button control to the left pane.

By default, the name of this control is Button.
 * 1) Double-click Button, click Rules, and then click Add.
 * 2) Click Add Action, and then click Set a field's value.
 * 3) Click the icon that is next to the Field box, and then click field1.
 * 4) Type a date in a format that is not valid, and then click OK.

For example, type 9/30/06, and then click OK.
 * 1) Click OK three times.
 * 2) On the toolbar, click Preview, and then click Button.

Additional query words: IP2007 InfoPath2007 IFS2007

Keywords: kbexpertiseinter kbtshoot kbprb KB924727

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.