Query under Sub-form

G

Guest

I have a sub-form that displays the 'many' information related to a key
identifier on the main form. The subform is based on a query that has
criteria set to a control (that displays the key identifier) on the main form
i.e. [forms]![frmname]![txtboxA].[value]

Now the query can easily get the information and display it, but I cannot
get the the data entry to work porperly. The information is stored in the
relevant table, but does not store the key identifier. Therefore next time I
open the query, the entered information is not displayed.

I have got this to work before, but for some reason this has gone awry. I
have referential integrity placed correctly, but is their some proprty or
some link I have missed?
 
N

Nikos Yannacopoulos

Chris,

The source of your problem is you haven't actually linked the subform to
the form, you are just filtering it instead, based on the value of a
control on the main form. To fix:

1. Remove the filter from the subform's recordsource
2. Open the main form in design view, select the subform object, display
its properties, go to the Data tab and select the appropriate field in
each of the Link Child Fields and Link Master Fields properties. For
instance, the master one should be the field to which txtboxA is bound.

HTH,
Nikos
 
G

Guest

I figured that might be the problem, however my main form is unbound. When
the main form is loaded, an SQL statement is loaded into the recordsource
property of the form depending on certain criteria. The txtboxA recordsource
never changes however.

But as the main form is unbound, then the '...' expression builder button
will not work. I get the error message "Cannot link to unbound form"

Nikos Yannacopoulos said:
Chris,

The source of your problem is you haven't actually linked the subform to
the form, you are just filtering it instead, based on the value of a
control on the main form. To fix:

1. Remove the filter from the subform's recordsource
2. Open the main form in design view, select the subform object, display
its properties, go to the Data tab and select the appropriate field in
each of the Link Child Fields and Link Master Fields properties. For
instance, the master one should be the field to which txtboxA is bound.

HTH,
Nikos
I have a sub-form that displays the 'many' information related to a key
identifier on the main form. The subform is based on a query that has
criteria set to a control (that displays the key identifier) on the main form
i.e. [forms]![frmname]![txtboxA].[value]

Now the query can easily get the information and display it, but I cannot
get the the data entry to work porperly. The information is stored in the
relevant table, but does not store the key identifier. Therefore next time I
open the query, the entered information is not displayed.

I have got this to work before, but for some reason this has gone awry. I
have referential integrity placed correctly, but is their some proprty or
some link I have missed?
 
R

Rick Brandt

Chris said:
I figured that might be the problem, however my main form is unbound.
When the main form is loaded, an SQL statement is loaded into the
recordsource property of the form depending on certain criteria. The
txtboxA recordsource never changes however.

But as the main form is unbound, then the '...' expression builder
button will not work. I get the error message "Cannot link to unbound
form"

So don't use the builder. Just type the entries into the property boxes.
 

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