ilottl
07-30-2010, 12:55 AM
I am simply trying to create a very basic access database for my brothers business.
Basically, we have a list of employees, and my sister in law would like to have a basic pay slip where she:
1. Chooses the Employee
2. Enters the Gross amount, tax deductions and hours they work, calculated each week so no tax etc calcs required
3. Selects to preview a "page" which can be give to the employee.
OK so I have some of the aspects right but the report page I cannot nail.
The hours entered display multiple times and I cannot get the address for the employee showing (I just get nothing).
Where am I going wrong?
I have attached a zip file of the access 2007 database if you have time to have a look.
Thanks in advance
Laz
Trevor G
07-30-2010, 01:06 AM
Welcome to the Forum,
You havent set your relationships up correctly.
Open the Database and then select the database tools tab then select the relationships, on each line that you see double click to open the relationships dialog box, (it will show you a relationshipof 1 to Many) then select enforce referential integrity, cascade update records and cascade delete records.
Then save, this then gives you the basis of a relational database.
I would then empty each table and start adding records again.
As to your report, if you create a query with the tables related you will get the address in the report.
ilottl
07-30-2010, 01:37 AM
Thanks Trevor,
I have modified the relationships but still get the same problem after creating the query..
SELECT tbl_Employees.[Last Name], tbl_Employees.[First Name], tbl_Employees.Address, tbl_Employees.City, tbl_Employees.Suburb, tbl_Employees.[Postal Code], [tbl_Work Information].WeekNumber, [tbl_Work Information].WeekEnding, [tbl_Work Information].PayDate, [tbl_Work Hours].Type, [tbl_Work Hours].Hours, [tbl_Work Hours].WorkInfoID
FROM (tbl_Employees INNER JOIN [tbl_Work Information] ON tbl_Employees.EmployeeID = [tbl_Work Information].EmployeeID) INNER JOIN [tbl_Work Hours] ON [tbl_Work Information].WorkInfoID = [tbl_Work Hours].WorkInfoID
WHERE ((([tbl_Work Hours].WorkInfoID)=[Forms]![frm_Work Information]![WorkInfoID]));
I get the name but no work hours or address even though I have added them to my report.
Trevor G
07-30-2010, 01:52 AM
I have downloaded your sample and have adjusted the relationships, then deleted the records,
Added some new forms into a single form, added a record, added a query and report.
All the data runs through correctly.
See if you can adjust to your needs.
ilottl
07-30-2010, 02:45 AM
Thanks again..
So apart from the relationships, the issues is that the table tbl_Work Information is not being populated with a EmployeeID and WorkHoursID to complete the relationship?
I tried Trevors zip file but stumbled across similar issues whereas, when I entered a new week, all hours would show.