LInking Tables

G

Griffij

I have a database that hold information about Employees It has 4 tables
within it, these are as follows:



Employee_Personal_Information (Table 1, Main Table)



PKEmployNatINS

Employdob

Employsurname

Employfirstname

Employtitle

Employhousename

Employaddress

Employtown

Employcity

Employcounty

Employpostcode

Empoloytelnumber

Employmobile

Employsecondtelnumber

Employfaxnumber

Employemail

Employnotes



Employee_Emergency_Information (Table 2, Subform)



PKEmployNatINS

EmployRelationship

EmployRelsurname

EmployRelfirstname

EmployReltitle

EmployRelhousename

EmployReladdress

EmployReltown

EmployRelcity

EmployRelcounty

EmployRelpostcode

EmpoloyReltelnumber

EmployRelmobile

EmployRelCompany

EmployRelCompanynumber

EmployRelextention

EmployRelNotes



Employee_Employment_Information (Table 3, Subform)



PKEmployNatINS

EmployEmpJobtitle

EmployEmpStartdate

EmployEmpEnddate

EmployEmpNotes



Employee_Driving_Information (Table 4, Subform)



PKEmployNatINS

EmployDriveYesNo

EmployDriveLicNo

EmployDrivePassDate

EmployDrivePointsYesNo

EmployDriveNotes







Above are all my tables that I have in the database, all the subforms
should be linked back to the main form. by buttons or the main form.



I have linked all the tables in the relationship window from the main
form to eech table with a 1 to 1 relationship.



I was told it would beasier for me to create 1 Main form and the rest
should be subforms.



When I created the subforms I have created them in a single form view,
to make it look like they are seperate forms.



The prolem I have is that when I enter data in the Main form, I then
click on one of the buttons to complete a subform, the forms opens
blank like. I want it to open as a relation of the main form with the
Employee National Insurance number copied over so I know they are one
and the same.



The Code I am using is below:



Dim stDocName As String

Dim stLinkCriteria As String



stDocName = "Employee_Emergency_Information subform"



stLinkCriteria = "[EmpNatins]=" & "'" & Me![EmpNatIns] & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria





Would some ne please help with this as I am losing my mind over it



Regards Joel
 
T

tom

Above are all my tables that I have in the database, all the subforms
should be linked back to the main form. by buttons or the main form.

Why use buttons? Place the 3 subforms on the main form, either on the one
page or use 3 separate pages.
I have linked all the tables in the relationship window from the main
form to eech table with a 1 to 1 relationship.

This seems fine...
I was told it would beasier for me to create 1 Main form and the rest
should be subforms.

See above...
When I created the subforms I have created them in a single form view,
to make it look like they are seperate forms.

Don't know what you mean? Do you mean the Default View? For a 1-1
relationship this is fine...
The prolem I have is that when I enter data in the Main form, I then
click on one of the buttons to complete a subform, the forms opens
blank like. I want it to open as a relation of the main form with the
Employee National Insurance number copied over so I know they are one
and the same.

Why make it difficult for yourself... This is easily achieved when you know
Access... but for now see above.

Tom.
 

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