Replace VB code to change characters - InfoPath Dev
in

InfoPath Dev

Replace VB code to change characters

Last post 05-21-2011 11:53 AM by rev_ollie. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 05-21-2011 11:53 AM

    Replace VB code to change characters

    Hi, I'm doing some general IT odd jobs and one of the tasks is using Infopath. The problem is the back end system they use uses / in dates - however when the form is filled in a variety of characters are used - mainly .

    In order to automate it I wanted to add VB validate code to the box that would replace "." with "/". I have never used VB or info path so in kinda deep here.

    I have the following which I tried to use (on a test form - just 1 input box) - probably not right:

    Public Sub field1_Validating(ByVal sender As Object, ByVal e As XmlValidatingEventArgs) document.write(Replace(txt, ".", "/")) End Sub

    The box is formatted to date. Here are the issues:
    1 - If I enter the data as 10.10.05 - It updates the full stops - but also the date i.e it changes from 10.10.05 to 30/12/1899??

    2 - If i enter the date as 10.10.2005 - the box goes red indicating the formatting is wrong...and non of the characters change.

    3 - If I then change it to a standard text box - nothing happens at all.

    Any ideas?? Seems very simple I'm sure but to me this is all new!

    Thanks for you time
Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.