Update form & date time field

Platform: ASP classic
DB: MSSQL
I have a datetime field on an update form that is giving me
fits. When
I do not enter a value it throw an error about wrong data
type. When I
put this code in
if (isnull(CStr(Request.Form("Left_Date")))) then
that processes the update without the datetime field. The
else part of
the statement processes with the datetime field. The if does
not work.
Any idea how this situation should be handled?

jsteinmann wrote:
> does that column allow nulls?
This morning I did a little more digging and ended up with
isdate.
That solved the problem. I also had another problem, it was a
kin to
hitting yourself in the head with a hammer, your head won't
hurt if you
quite swinging the hammer.
But to answer your question, yes it did allow nulls.
Thanks for the response.

Similar Messages

  • Automatically displaying date and time in a date/time field on form initialize

    Good day all;
    I am trying to have the current date and time automatically be generated in a “date/time” field when the form is opened.
    I went through the forum and found an entry from Srini “ xfa.host.messageBox("" + Date());” . Of course this brought up a system message box with the date and time.
    I then tried “DateTimeField1.rawValue = (“”+date())… This also gave me a system message box with the date and time…
    Please let me know where I am going wrong
    Chomp

    Found the answer... And yes... in was in the "help" section... What can I say I was making it a lot more crazy than I needed to.
    You can use a date/time field to automatically show the current date by using the Runtime Property option in the Value tab of the Object palette.
    When using a current date field, the date updates to reflect the system’s current date each time a user opens the form.
    1.
    In the Library palette, click the Standard category and drag a Date/Time Field object onto the form design.
    2.
    In the Object palette, click the Value tab and select Calculated - Read Only from the Type list.
    3.
    Select the Runtime Property option.
    4.
    View the form in the Preview PDF tab.

  • Problem with Date/Time field in Adobe LiveCycle

    I am trying to create a form that has a check-in and check-out dates. I want the user to enter those dates and then have the form automatically compute how many nights the user intends on staying.
    I have two fields, CHECKIN and CHECKOUT, set up as text fields. My third field, NIGHTS, has the following script to do the calculation:
    var strStart = CHECKIN.rawValue
    var strEnd = CHECKOUT.rawValue
    if(strStart.length && strEnd.length)
    var dateStart = util.scand("mmm d, yyyy",strStart);
    var dateEnd = util.scand("mmm d, yyyy",strEnd);
    var diff = dateEnd.getTime() - dateStart.getTime();
    var oneDay = 24 * 60 * 60 * 1000;
    var days = Math.floor(diff/oneDay);
    this.rawValue = days;
    else
    this.rawValue = 0;
    NOW...this is fine if the user inputs a four-digit year. If not, it's trouble. SO, what I want to do is change the CHECKIN and CHECKOUT fields to the date/time field so they select the date off the pop-up calendar.
    When I make the changes, I can't get the script to work for the NIGHTS field.
    CAN ANYONE HELP THIS NEWBIE?

    Make sure the format of the date strings provided by the calendar is what you are expecting. Or use the "formattedValue" for the input strings.

  • How to get calendar icon to show again when entering data in date/time field.

    Hello,
    First time posting on this site.  I am fairly new to using SQL Server Express.  I created a split-database in MS Access 2010 and have successfully migrated over the backend database to SQL Server Express.  When I was using the FE forms in
    Access, I use to be able to see a calendar icon where I could select the month and day in the date/time field.  
    I compiled the FE forms to binary format .accde so that I could distribute this to the users and they couldn't change my forms. After migrating the tables to SQL Server express for the BE, I am no longer able to see the calendar icon when I try to enter
    in data in the date/time field.   Same for the original .accdb file before the binary conversion to .accde.  
    How do I get the calendar icon back to show on the form when a user is entering in data?  I appreciate any assistance I can get. Thank you!
    Thai

    Hello Cheer,
    I don't believe the table changed when migrating from Access.  I had two tables before the migration, one was for the SwitchBoard Manager and the other table was for the database table.  I used the Switchboard to navigate to different menus, such
    as the Main Form, Power Form, Server Form, etc.  Let me know if I can provide any other information to help you narrow this down for me.   
    Thank you for your assistance. 
    Thai

  • How to compare Date in the TextField or DateTime with Date/Time field?

    Hi All,
    I am facing an issue with respect Date comparinson. I tried to look into entire discussions but failed to get the answer.
    My issue is: I wanted to comparet Date/time field value with Date value which is in TextField.
    The functionality of my form is:
    I have dropdown list which lists the registered customer ids binded to XML Datasource. On selection of the customer id from the dropdown I am displaying customer registration date in the TextField or say Date/Time field as below code in dropdown change event.
    RegistrationDetails.PurchaseEntry.txtRegDate.rawValue = regDataNode.CREATION_DATE.value; (this is TextField control)
    In form I have an Date/Time field in which use will select the date of item purchase. In the validation part I want to make sure that, the purchase date selected in Date/Time field must be greater than the Customer Registraiton Date. I able to compare if the customer selects the date from two different Date/Time fields. But how to compare the dates which one is in Date/Time field and Date is in TextField?
    I have tried using Num2Date and Date2Num with "YYYY-MM-DD"  format to compare but not succeed!
    Can you guys help me in this? Thanks in advance
    Regards.

    Hi,
    Yes, I am able to display the date which I have assigned to the text box. In the message box it show the value as '31/05/2009', since in this format i am assigining the date in the text box.
    Here is the code which I am assigning the value:
    RegistrationDetails.PurchaseEntry.txtRegDate.rawValue = regDataNode.CREATION_DATE.value;
    Do I need to change the format while assigning value in text box?
    You have told that, you have attached your test form, nothing is the reply. Can you repost the file?
    Regards.

  • Date/Time field format not wysiwyg

    I have a date field in my form that I formatted as m/d/yyyy hh:mm.  I thought that because it formats that field in that way my script would get passed down that way however it is not.  I want to manipulate it so the value is in the format I want it to be....
    I enter this in the date/time field: April 1, 2011 1:40PM
    When I click out of the field and I see: 4/1/2011 13:40
    Then I have a script that uses this field to make the file name but because I have a comma in there it will not save, if I take the comma out it will save.  So the main question is how do I format my field to pass down the value that I am seeing not the value that I am typing in.  You will notice I have a replace in there but I can't account for the comma because it reads it as part of the syntax.
    // Get the field value
    var dtentered = getField("datetime").value;  
    //replace any odd characters that will not allow the file to save
    var fdt = dtentered.replace(/[!@#$%^&*()+=|\:;"'<>?/{}]/g,"_");  
    // Specify the folder
    var fldr = "/c/WO Completed/";
    // Determine the full name and path
    var fp = fldr +  fdt + ".pdf";

    Thanks for the response...I'm not sure that I understand what you mean back-slash...I went ahead and did this but now it is giving me an odd file name
    // Get the field value
    var dt = getField("datetime").value;
    var mydt = escape(dt);
    //replace any odd characters that will not allow the file to save
    var fdt = mydt.replace(/[!@#$%^&*()+=|\:;"'<>?/{}]/g,"_");
    // Specify the folder
    var fldr = "/c/WO Completed/";
    // Determine the full name and path
    var fp = fldr + fdt + ".pdf";
    Returns a file name as
    April_201_2C_202011_201_3A40PM.pdf
    I was looking more for
    4_1_2011_13_40.pdf
    or
    April_1_2011_1_40PM.pdf

  • Date time field problem

    Hello there
    This maybe a simple problem but on the Date time field object i have input a display pattern and put the error message in. When I preview the PDF and populate the object with random text the pop up box will display my error message.
    What it does not do is clear the text I have input so the date can be re-entered correctly, which is what I was expecting. Therefore the user can continue on without addressing the date correctly.
    Can anyone advise what I should do to get this to work?
    Thanks
    Darren

    Hi
    The first time I thinkanyone has answered their own post. So for the benefit of anyone else I added the folowing script to the exit event
    of the date field object
    if (page.subform.dateobject.rawValue == page.subform.dateobject.formattedValue) {
    xfa.host.resetData("xfa.form.Formtitle.Page.subform.datefieldobject")
    Not sure why it works but just played around with it.

  • Adobe LiveCycle Date/Time Field Scripting Question

    I have a date/time field in Livecycle which the end user chooses a random date from.  I need to populate a date 180 days from this date for an eligible to date/time field.  I have tried various javascript and formcalc options with no success.

    Try this site here for a reference: http://eslifeline.wordpress.com/2008/09/26/date-manipulation/
    The following was the use case. A form has 2 TextFields Start_Date and End_date
    User enters a certain date in the Start_Date text field for example 09/24/08 (MM/DD/YY)
    The End_Date should add 90 days to the Start_date and populate the End_Date
    The following script would do that
    var current = Date2Num(Start_Date.rawValue, “MM/DD/YY”)
    var future = current+90
    var newDate = Num2Date(future,”MM/DD/YY”)
    form1.#subform[0].End_Date.rawValue = newDate 
    Validating End Date is later than Start Date
    var diff = Date2Num(EndingDate.rawValue, “YYYY-MM-DD”) – Date2Num(StartingDate.rawValue, “YYYY-MM-DD”)
    if (diff > 0) then
    xfa.host.messageBox(“The End date is later than start date”)
    else
    xfa.host.messageBox(“PLEASE CHECK….The End date is before the start date”)
    endif

  • How can I set a date range for a Date/Time Field in LiveCycle ES2?

    I need to set a specific date range for a form set up in LiveCycle ES2. Cannot see where i allows me to do that without a code entered.

    Hi,
    You can't set a start and end date for the date/time field, the best you can do is validate the range after the user has selected it.
    An alternate is to make your own date / time field, like this sample http://adobelivecycledesignercookbookbybr001.blogspot.com.au/2013/05/an-alternative-date-p icker-for.html
    Regards
    Bruce

  • CDHDR date/time fields vs. changenr field - what's the proper order ?

    I have an application where I need to keep track of all the changes on sales orders.  Got it working pretty well, but in production it has the nasty habit of missing some changes ( it runs every 15 minutes and keeps track of the last date/time of an item it picked up ).  What's worse is that if I do a full run from scratch, the missing stuff appears.
    I think my algolrithim is flawed because of the missing things plus I found two entries who's entries look like the following (all in VERKBELEG) - yes, this is REAL data from my production system:
    changenr          udate     utime
    0004520883     2/27/2007     19:20:24
    0004522894     2/27/2007     19:16:31
    Apologies for the formatting - anyways, as you can see - which entry happened first?  Is the changenr field the authority on that or is the date/time fields ?  I have to think it's changenr because of the following:
    1 - changenr is part of the primary key - date and/or time is not
    2 - my program is missing changes
    What's even wierder is that the above two changes were made by the same person - and I have no idea which one they did first.
    bottom line - what determines order of changes ? - field changenr or date/time fields (which are udate and utime respectively).  I thought when I designed this the first time that it would been entry #2 above, but now I'm thinking it's entry #1.

    Tom;
    Thank you very much for the information - I did run transaction SNRO and I see on my dev box that it's buffered ( 10 numbers ).  This then leads to my next set of questions:
    1 - If you have multiple app servers and it's bufferered, where does it buffer ?
    2 - Are the change numbers still in order of the changes ( see #4 below ) ?
    3 - When a change number is buffered - does that mean the entire change is buffered or does that mean that only the number is buffered ?
    4 - If you have multiple app servers with multiple changes - do the changes appear in the database in order of the change numbers or out of order ?  Here's a simple example:
        change 1 - done by app server 1
        change 2 - done by app server 2
        change 3 - done by app server 1
        change 4 - done by app server 1
        change 5 - done by app server 2
    At any point, would I see any change number in the database which has a higher change number than one that doesn't yet exist in a commited form in the database ?  In order words, if I did the read just right, would I see changes 1,3,4 on one read and then 15 minutes later 1,2,3,4,5 ?  The reason I'm asking is because if you want to remember where you last left off, if a change number "appears" later and not in order, tracking the change numbers won't help either.

  • Issue: format / "language" of current Date (in date/time field), javascript only

    Hi,
    I have 2 date fields in my form, which should display the date in differnt format. (yyyy.mm.dd /  dd-mm-yyyy)
    To get the current date I use java script only
    Formular1.p1.date_YYYYmmDD::initialize - (JavaScript, client)
         var date = new Date();
        this.rawValue  =  date.toLocaleDateString();
    My first problem is (red): I get date in English, but I want it in a different language. As it was set in form settings
    My second issue is: how can I format a date/time-filed (not a text field) in javascript with a specific pattern on init-event?
    It seems my code in init-event overrides the pattern configuration of the date/time-field
    Here is my form, if anyone want to check it:
    https://acrobat.com/#d=zeOMyj9MhBdYbVWk8S1pHw

    Hi,
    I think both problems are the same, when setting a date/time field using the rawValue the format always has to be yyyy-mm-dd, if you use any other format the value is just treated as text and displayed without formatting.  
    var date = new Date();
    this.rawValue = util.printd("yyyy-mm-dd", date);
    You can also set the formattedValue if you have a date in the correct format. 
    var date = new Date();
    var currentLocale = xfa.resolveNode("#localeSet.#locale").name;
    var dateFormat = "date("+currentLocale+"){DD MMM, YYYY}"
    this.formattedValue = util.printd(dateFormat, date, true) 
    This code assumes the display pattern is date{DD MMM, YYYY}
    The date format specification is in the XFA Spec http://partners.adobe.com/public/developer/xml/index_arch.html
    Regards
    Bruce

  • Adding Date/Time Field + X Number of Days - Basic Calculation Question

    I am assuming this is a basic calculation question. New to Adobe LiveCycle Forms.
    I have a simple form containing a table. The table appears as such:
    Text
    Formatted as Date/Time Fields
    Header 3
    Monday
    user wil choose the beginning date (Date/Time) this is DateTimeField1
    Tuesday
    this should calculate DateTimeField1 + 1
    Wednesday
    this should calculate DateTimeField1 + 2
    Thursday
    this should calculate DateTimeField1 + 3
    Friday
    this should calculate DateTimeField1 + 4
    Saturday
    this should calculate DateTimeField1 + 5
    Sunday
    this should calculate DateTimeField1 + 6
    Calculations are performed after the date is chosen for Monday. My mind tells me the simple calculation of DateTimeField1 + 1 is not going to work (and in fact doesn't!) as it needs to change Monday to a number first. I saw on another thread the following:
    Num2Date(Date2Num(Date(DateTimeField1), "DD.MM.YYYY")+7, "DD.MM.YYYY")
    Thought this was going to get me close. No cigars though!
    Any quick help is greatly appreciated. And since I am new to this, details about what needs to be changed would be great too!
    Thanks

    Here an addition for you date field.
    This FormCalc script in the exit:Event will check it the selected date is on a monday.
    If not it will go the days back until the last monday.
    var Selection = Date2Num($.formattedValue, DateFmt(2))
    var WeekDay = Num2Date(Selection, "E")
    var NewDate
    if (WeekDay eq 1) then
              NewDate = Selection - 6
    elseif (WeekDay eq 3) then
              NewDate = Selection - 1
    elseif (WeekDay eq 4) then
              NewDate = Selection - 2
    elseif (WeekDay eq 5) then
              NewDate = Selection - 3
    elseif (WeekDay eq 6) then
              NewDate = Selection - 4
    elseif (WeekDay eq 7) then
              NewDate = Selection - 5
    else
              NewDate = Selection
    endif
    $ = Num2Date(NewDate, "EEE DD.MM.YYYY")
    Hope this helps, too.

  • How to prevent an automatic fill in of the current date into a Date/Time Field

    hi,
    maybe i checked out a strange behaviour of the adobe designer. when i put a "normal" data/time field (with no data pattern, display pattern, etc.) on a form and then change (on the pdf preview tab) to the newly designed date field,i have to stay about 2 minutes on this field not filling it out.
    after these minutes the current date is filled in automatically in the date/time field.
    what can i do preventing that? any hints?
    thanks in advance.
    markus

    I don't have any info on timelines, all I can say is check back in future versions of Acrobat :(
    Chris
    Adobe Enterprise Developer Support

  • Calculate one month prior to user entered date by a Date/Time field

    Hi All,
    I am currently pretty new to Live cycle and have no idea about Java scripting, i have been using this site a lot for my forms and have used the FormCalc for expanding tables and so on but this one is proving difficult. I am currently designing a form that requires a calculation of one month prior to a user entered date by a Date/Time field. I have looked at multiple posts on how to do this but none have worked (they are using the Date2Num).
    Is anyone able to enlighten me please?
    I currently have:
    Date/Time field Date Due
    Date/Time field Planned Date of Review
    I need Planned Date of Review to be calculated to be 30 days prior to Date Due. How do I go about doing this? Is it incorrect to use a Date/Time field as the field type for the calculation?
    Cheers
    Brad

    You can use FormCalc to compare the user input.
    Put this script into the exit:Event of the date field.
    if (Date2Num($.formattedValue, "MM/DD/YYYY") ne date()) then
    $host.messageBox("The entered date is not todays date!")
    endif

  • Add one year to date/time field

    Hi All.
    In my form I have date/time field DATE with format MM/DD/YYYY. Add I would like when user selected according date in that field, the other field should display date on one year late then user selected in field DATE. I mean. If user install 8/27/2010 on DATE field in other field will display date 8/27/2011.
    Thanks.

    Hi Paul,
    Thanks for replay. In your example you used CLICK event. Is it possible to get date on other field without click button? For instance, if user just press TAB key on keyboard.
    Thanks.

Maybe you are looking for

  • Java.lang.NullPointerException consuming wsrp

    We are using wci 10g to consume a wsrp from peoplesoft 9.1 and peopletools 8.5. We can import the wsdl in the portlet settings and can pick the pagelet we want to run, but when we view the portlet is gives us a java.lang.NullPointerException. WCI sup

  • How do you go about quickly deleting photos on SD card before importing?

    II'm looking for quick efficient way to look over photos and discard obvious unwanted pics before import.

  • CMSS3D & Audio Effects...Only One at a Ti

    I have an Audigy 2 Platinum paired with the original release of the Klipsch Pro Media 4. setup. In the past when re-installing the sound card, I've always had much difficulty trying to get CMSS enabled, and also have an audio effect under 'Advanced E

  • Four weeks and first kernal panic (i think)

    I just shut down my computer, or at least I thought I did, and left my room for about 30 minutes. When I returned my fan was running full blast and the computer was 'off' (black screen)... When I tried to turn the computer on, it did not respond to t

  • IMPORT  canon 6d fyles in premiere cs 6

    hello there, i imported before fyles from my 550d to premiere. all went well. now with fyles from canon 6d, i got strange flickering..... white noise...... what should i do ? greetz Peter