I’ve been successful modifying this code so that the client can use the calendar pop-up to enter a date range into a date field while in search mode rather than having to type it manually. It works like this; when the code is tied to a command button, the first click opens the calendar, and the choice is placed in the designated LE. Then a @MSGBOX informs the user to press ok and then select the ending date for the range desired. It works great and places the dates in the LE like this: “01/01/2010..03/31/2010” and then the user can retrieve the matching records. The problem I’m having is that if the user only wants to select one date instead of a range and they press ESC to exit the second calendar, ESC enters a strange number into the LE. The number contains the first date selected, ie., “01/01/2010” plus “..2969203/03/26”. This number “..296923/03/26” appears to be the same no matter what first date is selected. A work around would be for the user to enter the same date twice to search, for example “01/01/2010..01/01/2010”.
Is there way to modify the code so that when ESC is pressed for the second calendar that it leaves the designated LE with only the first date?
Thanks for your help. [code] var MyDate as String var vDate1 as String var vDate2 as String
If @Mode() = 2 Then { If @isblank(EntryDate) myDate = @Calendar("", "Select a Beginning Date (Esc to Cancel)") If Not @Error MyDate = @Right(MyDate, 5) + "/" + @Left(MyDate, 4) FormFieldValue(@Layout + ":(Search)", "EntryDate", 0, MyDate) }
If @Mode() = 2 Then { @MSGBOX("","For a date range, Press OK and then select an ending date","Otherwise press OK then ESC") }
If @Mode() = 2 and not @isblank(EntryDate) { vDate1 = @Right(EntryDate, 5) + "/" + @Left(EntryDate, 4) vDate2 = @Calendar("", "Select an Ending Date (Esc to Cancel)") If Not @Error vDate2 = @Right(vDate2, 5) + "/" + @Left(vDate2, 4) FormFieldValue(@Layout + ":(Search)", "EntryDate", 0, vDate1 + ".." + vDate2) } Else
{ EntryDate = @Calendar("", "Select A Date (Esc to Cancel)") }
[/code]
|