RequiredFieldValidator with RadNumericTextBox - requiredfieldvalidator

When I combine a RadNumericTextBox with RequiredFieldValidator with a mask of "<0..99>:<0..59>:<0..59>" I don't get the error message when nothing is entered, because by default "00:00:00" is saved. How can I prevent from the text box assuming that "00:00:00" is a legitimate value.

Related

Recognition of a date as a date in Access Forms filtering

I have an Access data table with the Field "RequiredUntil", which is from the type "Date/Time", and several other columns, and a form, in which I show that table, and where I usually use right mouse click to filter for what I want. The text box for "RequiredUntil" is formatted as "Short Date".
Part of the form:
When I now do a right click on the field "RequiredUntil" in that form, Access properly recognizes that as a date, and offers me several date filters, i.e. Today, "This week", Past,... So I don't use any SQL there, all is done by Access!
When I select "Today" (or Yesterday or Tomorrow), I get a "Data type mismatch in criteria expression" error.
When I select "This week" (or any other time period), the filter is properly set - but as soon as I filter the next column, I get a
Syntax Error in Query expression '((Year([DataTable].[RequiredUntil])=Year(Date())) AND
(DatePart("ww";[DataTable].[RequiredUntil];0)=DatePart("ww",Date(),0))'.
In that case, the date filter is revoked, and only the second filter is applied.
So, I don't do any SQL, RequiredUntil is of the type Date/Time, the text field in the Form is Date/Time, Access recognizes it as Date - what am I missing?
I'm pretty sure, the issue is caused by Null values in your date field.
If removed, you can set the filter, which will reveal as:
(DateSerial(Year([DataTable].[RequiredUntil]), Month([DataTable].[RequiredUntil]), Day([DataTable].[RequiredUntil])) = Date()+1)
which, obviously, will fail, as DateSerial doesn't accept Null values.

Date time parameter in SSRS

I have a report which requires user to type the start date and also allow them to choose from calendar. I was wondering if its possible to enter the date as a string. Right now, I have a text field with calendar and I would like the user to enter date[06302015] instead of [06/30/2015]
can we omit the dashes and still have the report format it to date?
The type of a parameter can be changed from Parameter Properties like below.
This will remove the Calendar and it will be only a Text box.
Change your parameter type to "Text".
Add a second "Hidden" parameter (as Date/Time data Type) that takes the LAST_DATE_EDITED as an input into the 2nd parameter's default value using the expression: =DateValue(Mid(Parameters!LAST_DATE_EDITED.Value,1,2) & "/" & Mid(Parameters!LAST_DATE_EDITED.Value,3,2) & "/" & Mid(Parameters!LAST_DATE_EDITED.Value,5,4))
(Not tested, but it should be close)
Then use the 2nd parameter in your report instead of LAST_DATE_EDITED.
If the user inputs an incorrectly formatted string of numbers, uses text, etc., SSRS will throw an exception.
IMO, this isn't the most elegant solution and it demands user input that is prone to errors. Not what I would implement (I would have the users use the built in DateTime picker and train them to use valid separators such as periods, slashes or dashes or just use the calendar control).

Access Default Value Giving #Size! Error

I am using an Access 2013 form for calculations. I have a user inputting the hours they work in a text box for each day of the week. Labeled accordingly txtMonday, txtTuesday etc. I have a text box for all the hours worked txtTotalHours which I am setting the default value for with this formula =NZ(txtMonday,0)+NZ(txtTuesday,0)+NZ(txtWednesday,0)+NZ(txtThursday,0)+NZ(txtFriday,0)+NZ(txtSaturday,0)+NZ(txtSunday,0) this presents an error of #Size!
I thought the NZ() would account for any issues, but I still get an error. What can I do to overcome this error and have my calculation show a 0 if all the days are zero or null or blank, OR the SUM if the days have a value input?
I think you need to do two things
First wrap each NZ calc in a Val() function - in case it's actually concatenating the text box values as strings - before you trying to convert to an integer value - assuming you have the TotalHours field defined as integer - you didn't say.
Second put the formula in the ControlSource property (not DefaultValue) and then if you actually want it bound to a field, use code to update the actual field AfterUpdate
=Val(NZ(txtMonday,0))+Val(NZ(txtTuesday,0))+Val(NZ(txtWednesday,0))+Val(NZ(txtThursday,0))+Val(NZ(txtFriday,0))+Val(NZ(txtSaturday,0))+Val(NZ(txtSunday,0))

MSAccess Change Date Value Before Validation

In a grid I have a date/time field where I would like the user to be able to type in short-hand formats for dates and times. For example, if they type in "435p" and then focus off of the cell they get the message "The value you entered isn't valid for this field.". Instead, I want to trap a pre-validationevent and change it to "4:35pm" for them.
What event can I use?
I've tried:
LostFocus & BeforeUpdate: too late (validation fires before event)
Dirty & OnChange: too early (they haven't left the cell yet)
Or is there a way to turn off the native validation rule that is checking for date formats?
You could use an additional text field without formatting (or with your very own format). Then show this instead of the datetime-field and update the date-time field with your code.
Not very pretty, but if you always format the input to a proper time string on before-update and never access this field (but rather the real date-time field) you should be ok. You could even name the field Helper_DateTime or somesuch, so you are never tempted to access the field from anywhere else ;)

Validation Problem in vba text box

I want to validate a text box
where the user enters the date in format dd/mm
and time hh/mm
in the same text box
how to do this?
There is no simple way to achieve this. There are a couple of complicated ways.
You can make the control unbound, then write a handler for the After Update event of the control. In this handler, you will need to validate the user's entry, create a date value from the entry (presumably defaulting the year to the current year), and assign that value to the field storing the date. In addition, you will need an OnCurrent event on the form, where you will set the value of the unbound control to be the appropriately-formatted text version of the date of the current record.
Note that this method won't work in a Continuous form, only on a Single Form.