Locking Data once entered

K

Karl

Hello,

I am working on a time database for employees to enter time. I have 4
tables, one with all the days of the year, one with employee names, one
work table that links the date and employee tables and a time table where the
time info gets entered. that is linked to the work table.
The tables look similar to the following


Employee Table Date Table Work Table Time Table
Employee Id Date ID Work ID Time ID
Employee Name Date Date ID Time
Pay Period Employee ID Project

Work ID

In the first form employees select the day of the year by scrolling through
the list of dates. In a subform I have a drop down list where employees
select there name from a the drop down menu. I then want to have a subform
where the employee enters there time information. However, I am running into
a problem with employees accidentally changing the names of the employee when
they are entering there time, which causes the time subform to get associated
with the wrong employee. so i was wondering if it would be possible to set
the drop down employee list so that it can't be edited once an employee name
is selected, but still allows for entry into the time subform once an
employees name is selected.

thanks,
Karl
 
A

Allen Browne

Use the Current event of the main form to lock the EmployeeID combo.

Private Sub Form_Current()
Dim bLock As Boolean
bLock = Not (Me.NewRecord Or IsNull(Me.EmployeeID))
Me.[EmployeeID].Locked = bLock
End Sub
 

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