validationrule and dates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I would like to limit the input of a textbox to the smallest and biggest
date occuring in my query. I'm trying to accomplish this with setting the
validation rule using VB.
Text12.ValidationRule = ">= #" & mindate & "# And <= #" & maxdate & "#"
Strange enough, only for the second part (maxdate) in the properties box for
this textbox, the days and months are inversed displaying 4 jan as 01-04
instead om 04-01.
I checked all settings and i'm sure that maxdate contains 04-01 as value
that is passed on by the VB-code towards the validationrule property.
 
Did that a long time ago ;-)
But as I wrote, for the first part declared as "mindate" the date is passed
correctly (29-11-2004) is properly showed in the validation rule property box
as 29-11-2004.
It's the second part "maxdate" were the inversion is occuring

Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.MoveFirst
mindate = Format(rst.Fields(0), "ddddd")
rst.MoveLast
maxdate = Format(rst.Fields(0), "ddddd")
Debug.Print rst.Fields(5), mindate, maxdate
Text12.Value = mindate
Text14.Value = maxdate
Text12.ValidationRule = ">= #" & mindate & "# And <= #" &_ maxdate & "#"
Text14.ValidationRule = ">= #" & mindate & "# And <= #" &_ maxdate & "#"
 
Back
Top