Double entry

A

Alex Martinez

Hello,

I am recording or a user the number hours each employees worked each week in
Access. For example:

Name Days Worked Week Ending Date
John Dull 4 11/04/2005


My problem is that the user or I sometimes double count the employee. How
can I code it so I don't enter John Dull twice? Any tips will be
appreciated. Thank you.
 
A

Allen Browne

Create a unique index on the employee + date.

1. Open your table in design view.

2. Open the Indexes dialog (View menu.)

3. Enter on the first blank row in the dialog, enter a name for the index
(anything you like) in the first column, and in the 2nd column select the
employee field name.

4. In the lower pane of the dialog set the Unique property to Yes.

5. On the next row of the dialog, leave the index name column blank, and in
the 2nd column select the WeekEndingDate field. The 2 rows of the dialog
will look something like this:
EmployeeIdWeekEndingDate EmployeeID
WeekEndingDate

6. Save the changes.

This will prevent you from entering 2 records for the same person and date.

You probably don't have a field named "Name". That will cause interminable
problems if you do, because almost every object in Access has a Name
property. You probably have a table of employees with an EmployeeID (like
Northwind does).
 
A

Alex Martinez

Thanks Allen, worked like a charm.


Allen Browne said:
Create a unique index on the employee + date.

1. Open your table in design view.

2. Open the Indexes dialog (View menu.)

3. Enter on the first blank row in the dialog, enter a name for the index
(anything you like) in the first column, and in the 2nd column select the
employee field name.

4. In the lower pane of the dialog set the Unique property to Yes.

5. On the next row of the dialog, leave the index name column blank, and
in the 2nd column select the WeekEndingDate field. The 2 rows of the
dialog will look something like this:
EmployeeIdWeekEndingDate EmployeeID
WeekEndingDate

6. Save the changes.

This will prevent you from entering 2 records for the same person and
date.

You probably don't have a field named "Name". That will cause interminable
problems if you do, because almost every object in Access has a Name
property. You probably have a table of employees with an EmployeeID (like
Northwind does).
 

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