Subform Data Linked To Combobox Selection

Aussie60

Registered User.
Local time
Today, 22:12
Joined
May 1, 2011
Messages
41
Hi

Can someone point me in the right direction.

I have a main form with a combo box for selecting a project number, when the project number is selected it shows the projects number, projects name and $ value in text boxes at the top of the main form this all works fine. Below this data i have a subform which shows employees name, date, hours worked, hourly rate and total $ value.This data comes from a query and works fine except it is showing data for all project numbers.

How do I get the suform to show the the data only for the project number selected in the combo box. At present it shows all employee data for all project numbers.

I hope I have explained it clearly
 
As I explained to you in my last post in this thread

http://www.access-programmers.co.uk/forums/showthread.php?t=209101

you have to have a ProjectID as your Primary Key in your Project Table and that same ProjectID in your Employees Table as a Foreign Key.

If you had this in both tables when setting up the Subform Access should have automatically linked the two and you would only see employees in the Subform who were assigned to the given Project.

If you have them in both tables and the Access Gnomes goofed up, as they sometimes do, you can manually link them in Design View by
  • Selecting the Subform Control (make sure you've selected the Control, not the Form on the Control
  • Go to Properties - Data
  • Set the Link Child Fields and Link Master Fields to whatever name you actually used for the ProjectID
and you should now be set.

You'll have to do the same thing linking the Suppliers and Subcontrators to their respective Subforms.

Good Luck!

Linq ;0)>
 
Missingling

Thanks for the help with linking the subforms to the main form. The subforms now show the column headings but no data. The top half of the form is still working fine showing the projects static data in the textboxes and changes when I change project numbers in the combobox. But no data showing in the subform.

Also on the main form I have a command button to switch to another form that has subforms attached to 3 tabs for entering the data as I want the first form for only viewing project data. Two of the subforms (Subcontractor Labour) & (Employee Labour) work great but the third one Materials shows all the data in design view but nothing in form view just a white screen and the main form label. It also comes up with the following error message when I switch from design view to form view. The 'tblMaterials' is already opended exclusively by another user, or it is already open through the user interface and cannot be manipulated programmatically.

Any suggestions
 
Missingling

I managed to sort the problem with trial & error. I i didn't select the subform control which wasn't letting me link the form and subform. Its all coming together now. The only problem I have now is that when I select project number and data in the subform that is associated with that project number keeps blinking. Any idea whats causing this.
 

Users who are viewing this thread

Back
Top Bottom