Subform is launching dialog box asking for info that should be coming from the parent

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

AnnaHansen

Thread Starter
Joined
Jan 13, 2015
Messages
4
Hello,

I have a subform that is supposed to display query results. The query is based on the order# field in the parent form and returns relevant details. When I open the form, and when I navigate to the next record, I am getting dialog boxes asking me for the value of the order#. After I populate the boxes it displays fine.

Both the parent form and the subform are set to Data Entry = No

I used expression builder when I set up the query to eliminate the chance of typos.

I am guessing that this is basically because the query is trying to run before the order# field has been populated when the form loads.

I have thought of a couple ways around this, one being a dialog box that asks you what order# you want to view before loading the form, and another being to move the order details to a separate form all together.

The problem with those options is that it has been specifically requested that entering new orders, viewing old orders, and viewing order details be all on the same form.

Is there some way around this so that the subform will populate on it's own properly both when the form is opened, and after navigating to another record?
 

OBP

Joined
Mar 8, 2005
Messages
19,895
AnnaHansen, welcome to the Forum.
Before I can answer your question I need a bit more info.
Is this Access 2007?
Is your subform query based solely on the data from a Subtable?
Did you create the Subform separately from the Mainform?
Or did you allow the Access Form generator create it as part of the main form?
Are the Master/Child Links between the 2 forms set to the order#?
What does the "Record Source" property say for each form?

The pop up message boxes are asking you for data that is not available from either the Query or the "Record Source" of one or more of the Forms.
You may think that they are based on the table or Query but Access versions 2007 onward have a tendency to create their own Recor Sources and they do not always work.
 

AnnaHansen

Thread Starter
Joined
Jan 13, 2015
Messages
4
Hello OBP!

Sorry I left out so much information! My frustration kicked my brain out of my head!

It is access 2007.
Correct, the query is only based on the one subtable.
I did create the subform separately before adding it to the main form using the "add subform/subreport" button
Not sure what this one means
The record source for the main form is my main data table, the record source for the subform is the query

Thanks!
 

OBP

Joined
Mar 8, 2005
Messages
19,895
Ok, when you added the subform did the Wizard set the Master/Child links on the 2 forms to be the order #?
If you look at the main form in design view and click on the "Frame" of the subform, it should bring up the properties for that form.
It's Name, if it Visible, it's source object (your subform) and
Link Master Fields
Link Child Fields
These two should have the field name in them that links the two forms, it may have used the Key Indexed field "ID" if you used Autonumber indexed fields.

See the attached Screen Print.
 

Attachments

AnnaHansen

Thread Starter
Joined
Jan 13, 2015
Messages
4
Oh I see what you mean. Duh. I don't know why I didn't get it at first!

"Link Master Fields" says ORDERID#;ORDERIDPART#
"Link Child Fields" says ORDERID#;ORDERIDPART#

We don't use autonumber. Those are the column headings from the table and query. Should they be the controls on the form/subform instead?

Edit:fixed typos
 

OBP

Joined
Mar 8, 2005
Messages
19,895
Should be ORDERID# to ORDERID#
So ORDERID# has to be in the query.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top