trouble linking subforms

  • Thread starter Slez via AccessMonster.com
  • Start date
S

Slez via AccessMonster.com

I have been unsuccessful at getting the Child Fields in subform records to
relate to the Master Fields. What I'm trying to do may be a bit different,
so I'll explain how everything is laid out, and hopefully someone can help.

On my form, frmMainScreen, I have a tab control: TabCtl51.

On the first tab of TabCtl51, I have a combo box called cboProjectName, whose
Row Source is: SELECT Project.ProjectID, Project.ProjectName FROM Project
ORDER BY ProjectName;

Also on the first tab is a subform: frmProjectSubFormTab, which is a form
that contains another tab control: TabCtl11. Controls on TabCtl11 are not
relating to the record selected in cboProjectName.

I have tried a number of different combinations, and currently have the
properties for frmProjectSubFormTab set as follows:
Link Child Fields: ProjectID;ProjectName
Link Master Fields: cboProjectName

Do I need to reference something differently because of the tab controls?
Any help is greatly appreciated!
Slez
 
D

Damian S

Hi Slez,

Does your subform contain a foreign key that relates to the ProjectID field
in the main form? If it does, this is the field that you should be linking.

The existence of a Tab control should have no bearing on it.

Hope this helps.

Damian.
 
G

Geoff

It's not clear what your intentions are. You have a combobox that displays
all projects. However, the projects are shown in a subform on your main
form. That means that the subform would (if it were working) only display a
subset of projects relating to the record displayed in the main form.

If the purpose of the combobox is to find records in the subform, then it
needs to display the same subset of projects as are displayed in the
subform. This is possible, but it would be difficult to explain how to do
this. In general terms, if this is your intention, then I'd create a new
combobox in the header of the subform using the Wizard to create a combobox
that Finds Records. But you have the extra complication of synchronizing
the combobox with the main form and the subform. Explaining how to
synchronise would be tricky.

Alternatively, if the purpose of the combobox is to display all projects and
change to the appropriate record in the main form for a given project, then
my initial reaction would be to say that the main form may need to be
redesigned with a view to putting the Project at the centre of things. But
I've not given it much thought.

It's probably best if you clarify in your own mind exactly what it is you're
trying to achieve.
Do I need to reference something differently because of the tab controls?

You shouldn't be trying to link the Master/Child fields in the subform
control to the combobox. The Master field should be a field in the master
form's Record Source and the child field should be the matching field in the
subform's Record Source. I think the Tab controls issue is irrelevant and
is clouding the problem.

Seek out articles on the Microsoft website dealing with subforms and
comboboxes.

Regards
Geoff.
 

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