> I've been reading your posts and I'm confused about what you're trying to do.
> You talk about printing a report, but you also talk about a form and combo
[quoted text clipped - 18 lines]
> >instance, I have what amounts to five sections that draw from the same two
> >tables. In each section, one combo box chooses an Agency and that choice
See comments/questions intersperced, below.
>Rick,
>
[quoted text clipped - 65 lines]
>> >
>> >Karen
Rick G
Sorry about the previous post... hit the enter key by mistake before I had
written anything.
See comments/questions interspersed, below.
>Rick,
>
>Indeed, the form collects the data for a report, actually a series of
>reports but that is not significant.
I'm still confused. When you say "collects the data", what does that mean?
Does that mean it's being input by the user? Or does it mean the form is
collecting existing data from existing database table in order to be printed on
the report later? Or what?
>Basically the report has 5 sections that are similar. In each section an
>Agency is selected, based on the Agency selection a following combobox is
[quoted text clipped - 3 lines]
>These are only sections in the sense that I've put a rectangle around the
>comboboxes and textboxes in a section to guide the user, nothing more.
In each section of the form, it looks like you have 3 steps:
1) The AgencyComboBox needs a query associated with it. This would be in the
combo box's Rowsource property. The query would look something like the
following: "SELECT Agency.AgencyID, Agency.Name FROM Agency ORDERED BY
Agency.Name". The combo box would display every agancy. This would be
identical for the Agency combo box in each section.
2) Once a selection were made in an AgencyComboBox, you would ReQuery the
AgentComboBox in the SAME section so that it would list the Agents associated
with that Agency. Each AgentComboBox would also have a query associated with
it. The query would be SOMETHING LIKE the following: "SELECT Agent.Name
Agent.AgentID FROM Agent ORDERED BY Agent.Name WHERE Agent.AgencyID =
AgencyComboBox1.??SelectedItem??.AgencyID". (Please note that off the top of
my head I'm not familiar with how to refer to the selected item in the
AgencyComboBox.) Note that this query is specifically refering to the selected
item in the specific Agency combo box in the same section - AgencyComboBox1.
The queries in each section would be a little different in that they would
refer to different combo boxes... AgencyComboBox2/3/4/5 (or whatever you named
them).
3) Once a selection is made in an AgentComboBox, use that combo box's selected
agent (AgentID) in the DLookups to get the information from the database to
display on in that section of the form.
>I could have created five separate tables for each of the Agencies and 5
>separate tables for Agents related to each Agency but since the basic
>structure of the tables would be identical, I chose to have 1 Agency table
>and 1 Agent table. The AgencyID is saved as a foreign key in the Agent
>table to designate the Agent's relationship to the Agency.
That's definately the wat to go - 1 Agency table and 1 Agent table.
>Karen
>
[quoted text clipped - 46 lines]
>> >
>> >Karen
Rick G
Karen - 07 Feb 2004 16:54 GMT
Thanks Rick,
Yes, I'm talking about a form in Access where the user makes selections.
Those selections are put in a Report table and later, in Word, those values
are merged into a report.
I have done everything you suggested although the Agency combos are slightly
different as each displays Agencies where the AgencyType is Investigation or
Law or Insurance.....that sort of thing.
I have using the AgencyID to pull the applicable Agents with a Select query
on the Agent's combobox's rowsource.
I am using DLookup to populate the textboxes after the Agent selection is
made.
What piques my interest is John's suggestion that I just use a query to base
the Report Access form on that would pull from the Report table and the
associated Agency and Agent table. I can figure this out in code per
combobox but I just fall down when I try to figure out how to use one
reasonable query for the form.
Thanks for help.
Karen
> Sorry about the previous post... hit the enter key by mistake before I had
> written anything.
[quoted text clipped - 104 lines]
>
> Rick G
RSGinCA - 07 Feb 2004 17:49 GMT
This should be easy and the Report wizard should take care of everything for
you.
However, I'm assuming that, in Access, you have actually defined the
relationships between the tables.
If you have done that, then all you need to do is run the Report wizard, and
specify the fields/tables that you want, and the report will be generated with
an appropriate SQL statement in the report's Record Source property. That SQL
statement will combine the records in your 3 tables appropriately to create the
report.
>What piques my interest is John's suggestion that I just use a query to base
>the Report Access form on that would pull from the Report table and the
>associated Agency and Agent table. I can figure this out in code per
>combobox but I just fall down when I try to figure out how to use one
>reasonable query for the form.
Rick G