show data from two tables with some calculation in a from

%3CLINGO-SUB%20id%3D%22lingo-sub-2690237%22%20slang%3D%22en-US%22%3Eshow%20data%20from%20two%20tables%20with%20some%20calculation%20in%20a%20from%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2690237%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20guys%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20build%20a%20small%20database%20for%20my%20business%2C%3C%2FP%3E%3CP%3EI%20have%203%20tables%3A%3C%2FP%3E%3CP%3EProjects%3A%3CBR%20%2F%3E-%20ProjID%3CBR%20%2F%3E-%20ProjName%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEmployees%3A%3C%2FP%3E%3CP%3E-%20EmpID%3CBR%20%2F%3E-%20EmpName%3CBR%20%2F%3E-%20EmpRate%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWork%3A%3C%2FP%3E%3CP%3E-ID%3CBR%20%2F%3E-ProjID%3CBR%20%2F%3E-EmpID%3CBR%20%2F%3E-Date%3CBR%20%2F%3E-WorkingHours%3CBR%20%2F%3E-overtime%3CBR%20%2F%3E-deposit%3CBR%20%2F%3E-credit%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20relationship%20between%20table%20as%20in%20the%20image%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22db1.png%22%20style%3D%22width%3A%20488px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F306119i760A33A190F40AB5%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22db1.png%22%20alt%3D%22db1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20a%20first%20step%2C%20I%20need%20to%20create%20a%20form%20as%20in%20the%20attached%20image%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22db2.png%22%20style%3D%22width%3A%20627px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F306121i4ED29CDEB67F3217%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22db2.png%22%20alt%3D%22db2.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Eat%20the%20top%2C%20we%20can%20select%20a%20project%20by%20Number%2C%20then%20the%20form%20shows%20only%20the%20employees%20who%20assigned%20for%20this%20project%2C%20once%20I%20choose%20the%20employee%20from%20the%20combo%20box%20(employee%20ID)%2C%20it%20shows%20the%20employee%20name%20in%20the%20text%20box%20next%20to%20it%2C%20and%20in%20the%20table%20blow%20it%20show%20all%20the%20records%20from%20table%3CSTRONG%3E%20work%2C%20%3C%2FSTRONG%3Eand%20add%20a%20column%20%3CSTRONG%3Ebalance%3C%2FSTRONG%3E%20that%20shows%20the%20difference%20between%20the%20credit%20and%20deposit%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20thanks%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2690237%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2690393%22%20slang%3D%22en-US%22%3ERe%3A%20show%20data%20from%20two%20tables%20with%20some%20calculation%20in%20a%20from%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2690393%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F87534%22%20target%3D%22_blank%22%3E%40Jihad%20Al-Jarady%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20appropriate%20design%20for%20this%20is%20a%20main%20form%20with%20a%20subform%20in%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20main%20form%20can%20be%20bound%20to%20either%20the%20Project%20table%20or%20the%20employee%20table%2C%20but%20I%20would%20expect%20it%20to%20be%20more%20useful%20to%20bind%20it%20to%20the%20Project%20table.%3C%2FP%3E%3CP%3EThe%20subform%20is%20bound%20to%20the%20Work%20table.%20The%20ID%20and%20ProjID%20fields%20in%20the%20subform%20do%20not%20need%20to%20be%20displayed%2C%20but%20do%20need%20to%20be%20in%20the%20subform.%20The%20employeeID%20in%20the%20subform%20is%20selected%20with%20a%20combo%20box%20and%20the%20other%20fields%20are%20entered%20as%20appropriate.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20design%20you%20sketched%20out%2C%20with%20both%20the%20employeeID%20and%20ProjectID%20on%20the%20main%20form%20won't%20work%20out%20in%20practice%20due%20to%20the%20relationships%20between%20the%20tables.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent Contributor

Hello guys,

 

I am trying to build a small database for my business,

I have 3 tables:

Projects:
- ProjID
- ProjName

 

Employees:

- EmpID
- EmpName
- EmpRate

 

Work:

-ID
-ProjID
-EmpID
-Date
-WorkingHours
-overtime
-deposit
-credit

 

The relationship between table as in the image 

db1.png

 

 

As a first step, I need to create a form as in the attached image:

db2.png

at the top, we can select a project by Number, then the form shows only the employees who assigned for this project, once I choose the employee from the combo box (employee ID), it shows the employee name in the text box next to it, and in the table blow it show all the records from table work, and add a column balance that shows the difference between the credit and deposit

 

Many thanks 

3 Replies

@Jihad Al-Jarady 

 

The appropriate design for this is a main form with a subform in it.

 

The main form can be bound to either the Project table or the employee table, but I would expect it to be more useful to bind it to the Project table.

The subform is bound to the Work table. The ID and ProjID fields in the subform do not need to be displayed, but do need to be in the subform. The employeeID in the subform is selected with a combo box and the other fields are entered as appropriate.

 

The design you sketched out, with both the employeeID and ProjectID on the main form won't work out in practice due to the relationships between the tables.

thank George for your quick answer, what is your suggestion regarding this:

The design you sketched out, with both the employeeID and ProjectID on the main form won't work out in practice due to the relationships between the tables.
My suggestion is that you use the main form/sub form design approach instead.