Date validation in subform textbox dependent upon form textbox

  • Thread starter Thread starter kmsacca
  • Start date Start date
K

kmsacca

Is it possible to restrict the date entry on a subform to dates within a time
period defined by a fiscal year entry on the parent form? My fiscal year is
July thru June, and I want any date entered on a subform entry to fall within
the fiscal year
 
Yes, it should be possible. You would write code in the subform that refers to:

Me.Parent.NameOfControl

where NameOfControl is the name of the control on the main form. This would
give you the fiscal year (or perhaps a date within a fiscal year) from which
you could use additional logic to determine if the date entered on the
subform was valid.

Of course, once you do this, you will not be able to open your subform as a
stand-alone form, without generating an error. That's probably not a big deal
if you only use this form as a subform.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
 
Back
Top