Autopopulate field/ Lock fields

G

Guest

Hi All I have two questions.

1) How would you auto populate a field to current date ( =date() ) based on
a check box selection.. The check box selections are Yes='1', No='2'. So if i
click Yes='1'( for processed) , i would like the date processed field to auto
populate with the current date automatically.?

2) how would i also "Lock" all the fields after the check box has been
selected yes='1'(processed) , and after I press the save command button
(after update...i think) on the form , after so that all fields are
uneditable?

Thanks Guys!,,
 
G

Guest

1)In the check box selection for Yes add this code in the After Update Event
If me.MyCheckBoxYes then
me.DatedField=date()
End If
me.refresh

2)On the On Current event of the form add this code:

If me.MyCheckBoxYes then
if me.allowedits then
me.allowedits=false
end if
else
if not me.allowedits then
me.allowedits=true
end if
end if

To access the events select properties from the view menu when you are in
form design view, then click on the event tab
 
A

Al Camp

I take it that your ProcessedDate field is bound to a date field in your
table...

Since a "1" locks the form, we don't have to deal with a "2" value at all.

Use the AfterUpdate event of your chkbox...
If YourChkBox = "1" Then
ProcessedDate = Date
Me.AllowEdits = False
Me.AllowDeletes = False
End If

You'll also need to lock each record, according to YourChkBox, as you browse
into them
Use the OnCurrent event of the form...
If YourChkBox = "1" Then
Me.AllowEdits = False
Me.AllowDeletes = False
End If

hth
Al Camp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top