Code would be something like this:
Private Sub Form_Current()
Dim blnLockControl As Boolean, blnPass As Boolean
Dim strPass As String
blnLockControl = (Abs(DateDiff("d", Me.txtDate.Value, Date())) <=7)
If blnLockControl = True Then
strPass = InputBox("Enter password:")
blnPass = (strPass <> "Password")
Me.NameOfAControl.Locked = (blnLockControl Or blnPass)
Me.NameOfAnotherControl.Locked = (blnLockControl Or blnPass)
' etc.
End If
End Sub
--
Ken Snell
<MS ACCESS MVP>
"A Moloney" <(E-Mail Removed)> wrote in message
news:743801c494d3$395c3110$(E-Mail Removed)...
> Cheers Ken. Any suggestion on coding to get me started?
> (sorry-new to access)
> >-----Original Message-----
> >You could use the Current event to run code that locks
> all controls for that
> >record if the date value in the textbox is within your
> desired range. You
> >also could use this event to ask for a password as you
> suggest.
> >
> >--
> >
> > Ken Snell
> ><MS ACCESS MVP>
> >
> >"A Moloney" <(E-Mail Removed)> wrote
> in message
> >news:06ae01c49417$beed06e0$(E-Mail Removed)...
> >> Hi
> >> I have a text box on my form that displays the selected
> >> date from a calender. Is there any way that if the
> >> displayed date is within (+/-) 7 days of todays date
> that
> >> a password prompt is displayed, one permission is full
> >> access and the other would be read-only?
> >>
> >> If this is not possible can i just automatically open
> the
> >> required record in read-only for everyone?
> >>
> >> Any help/alternatives appreciated.
> >
> >
> >.
> >
|