View Full Version : New To Access


D3T
03-25-2002, 04:16 AM
Hey there
Im new to access and am doing a school project in it.

Basically I have two tables in my project:
STAFF INFORMATION
PAYROLL

and a form called NEW INFORMATION

Currently my form is a wizard-made one that has a field for every part of both tables...
in other words you have to enter first name twice, one into PAYROLL > FIRST NAME, and again into STAFF INFORMATION > FIRST NAME.

I was wondering if anyone could help me by supplying an example where the data entered into one field in a form is added to TWO tables,

FIRST NAME TEXT BOX -> PAYROLL FIRST NAME FIELD + STAFF INFORMATION FIRST NAME FIELD.

Cheers.

Rich
03-25-2002, 05:20 AM
You need to do some investigation into relational db design. You don't need to store the staff name twice, Staff ID which should be the primary key in your staff table becomes the foreign key in the payroll table. Have a look at any of the sample db's created by the wizard, all should have examples of this structure.
HTH

D3T
03-26-2002, 03:59 AM
Err k.

I'll have a look at those.

Cheers.

D3T
03-26-2002, 04:08 AM
Now....
I cant even create a form..
All the inputs and labels are invisable (useing the form wizard)

:/

Rich
03-26-2002, 05:20 AM
Have you created the correct relationship between the two tables? You should have a one to many twixt Table Staff and Table Payroll. You can then use a Form/Subform to enter data or linked forms. I'd say most prefer the Form/Subform method.
HTH

D3T
03-26-2002, 06:47 AM
Dont understand all this "Jargon"
This is the first time i have used access before, and so when something doesnt work and i cant see a reason why i start looking for things to throw around.

My two tables are linked thus:

S.Info Payroll

ID <---------------> ID
First Name(s) First Name(s)
Surname Surname
Department Pay (week)
Office Pay (year)
Home Address
Home Phone

Now I CAN get a form to work (horray)
But still, it has a field for FIRST NAME Twice.

So now all i have to do is work out how to get the form to "record" to BOTH tables
Please could you give pointers on this...
...Could it be done using that script thing? :|

-Yours

not_rich_yet
03-26-2002, 10:12 AM
If you must have two tables, then I'd suggest the following:

'Staff'
StaffID
Forename
Surname
Department
Office
Address

'Payroll'
StaffID
WeeklyPay
YearlyPay

Using the relationships window, create a link between the StaffID fields in both tables.

Create a simple form via the wizard purely for the Staff table. Presently this can now be used to add, amend and remove staff members etc etc.

Create a tabular form based on the Payroll Table....save it.

Open up the Staff form and make sure the wizard option is enabled. Click on the 'subform' button on the toolbar and drag out an area big enough to hold the width of your Payroll form, and make it around 5 inches high. The wizard should hopefully ask you which form you wish to add, and then ask you what link to use between the forms....since the only one available is the StaffID <-> StaffID one it should work easily...

Hopefully, you should now have a single form which allows you to view, enter, update etc staff and pay details. Moving the record navigation buttons for the Staff form should then display the Payroll info relevant to the Staff member displayed....

He says with faith! This should work?

Hope this helps, though I'm still unusre if 2 tables are needed!

nry

Rich
03-26-2002, 11:34 AM
One staff member can have many payroll records, you therefore need two tables with a one to many relationship between them. I'm sorry that you find it difficult to grasp but untill you do you will find yourself in great difficulty. If you define the relationships and get the table structure correct the wizard will build the forms for you. Did you look at any databases built by the db wizard?

D3T
03-27-2002, 04:05 AM
It's OK now, Im taking a different approach,
Instead of having a first name in the staff information and a first name in the payroll, i just have a first name in teh staff information and use the ID numbers to link them

ie

S.info Payroll
ID <-------> ID
F.Name Pay (week)
S. Name Pay (year)
etc
etc

So as for the form, that now consist of the first name and second name, and other S.info fields, and two PAY fields..

..Problem Solved! Thanx for all the help.