Re: date entry validation problem
- From: "gg" <gg@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 8 Sep 2005 10:19:02 -0700
"Dylan Moran" wrote:
> Excellent. Thanks Allen.
>
> --
> I may not know VBA inside out, but from the outside I am looking in.
> Dylan Moran - Melbourne Australia
>
>
> "Allen Browne" wrote:
>
> > Your code indicates that you want to compare 2 values. In Windows, you have
> > no idea if the use will click on a text box (they may never visit it), or in
> > what order they will click on the controls.
> >
> > Therefore, you need to use the BeforeUpdate event of the *form* for
> > validation that involves comparing controls. Cancel the event to prevent the
> > bad data being written.
> >
> > Private Sub Form_BeforeUpdate(Cancel As Integer)
> > If Me.ElecReturnAcknowledgedDate < Me.ElecReturnSubmittedDate Then
> > Cancel = True
> > MsgBox "Your ack...
> > End If
> > End Sub
> >
> > Another other reason the MsgBox will not fire would be if either of the
> > dates were blank.
> >
> > Occassionally, you find that the Properties box is missing the [Event
> > Procedure] on the Events tab, which will also mean the code will not fire.
> >
> > --
> > Allen Browne - Microsoft MVP. Perth, Western Australia.
> > Tips for Access users - http://allenbrowne.com/tips.html
> > Reply to group, rather than allenbrowne at mvps dot org.
> >
> > "Dylan Moran" <DylanMoran@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > news:9BB3A633-5011-4DE2-9B77-DCC04F080226@xxxxxxxxxxxxxxxx
> > > This code does not seem to trigger. Any ideas why?
> > > The fields are text feilds formatted dd/mm/yy
> > > I assume this may be my problem.
> > > Any recommendations on how I can get this to work?
> > >
> > >
> > > Private Sub ElecReturnAcknowledgedDate_LostFocus()
> > >
> > > ' Date validation
> > >
> > > If Me.ElecReturnAcknowledgedDate.Value < Me.ElecReturnSubmittedDate.Value
> > > Then
> > > MsgBox "Your acknowledgement date is before the submitted date.", _
> > > vbExclamation, "Unexpected data"
> > > End If
> > >
> > > End Sub
> > >
> > >
> > >
> > > --
> > > I may not know VBA inside out, but from the outside I am looking in.
> > > Dylan Moran - Melbourne Australia
> >
> >
> >
.
- Prev by Date: equation in form won't equal
- Next by Date: Re: date entry validation problem
- Previous by thread: equation in form won't equal
- Next by thread: Re: date entry validation problem
- Index(es):
Relevant Pages
|