Hi Karen,
I have three tables: CON-16, Issued & Upcoming
You would be best to not use an special characters in the names of anything
that a developer can assign a name to (fields, tables, queries, forms,
reports, etc., along with the names of controls on forms and reports). Here
is a Microsoft KB (Knowledge Base) article that discusses this in more detail:
Special characters that you must avoid when you work with Access databases
http://support.microsoft.com/?id=826763
Otherwise, you will need to always remember to bracket the name of the
CON-16 table, as in [CON-16].
Issued - seems to have no primary key, contains Company, contain Project
Number field
This sounds like a join or linking table to me. This type of table is used
to define a many-to-many (M:N) relationship. It has the foreign key sides of
two one-to-many (1:M) relationships. In English, it sounds like the following
applies:
A Customer can have many projects (Upcoming records)
and
A Project (Upcoming record) can apply to many customers.
Do both of these sentences correctly describe the relationships between your
tables?
The fact that the join table has no primary key could be problematic,
especially if a multifield unique index has not been assigned on the Company
and Project Number fields. Without a combined field primary key, or a unique
index set on the two fields, there would be nothing to limit a person from
entering duplicate records into this table. In general, every table should
have a primary key (PK). A PK can include more than one field.
Based on what I've read so far, I believe you will want to have the Company
field from [CON-16] as the Link Master Field (so it must be in the recordset
for the report) and the Company field from the Issued table as the Link Child
field. This field must be available in the recordsource for the subreport.
Also, the fact that there is no primary key in Issued table was done
before my time here.)
Now would be a good time to fix this problem.
For the secondary query I used the same three tables; it produces all
Formal names & their associated projects - no limitations.
You can likely eliminate the [CON-16] table from this query, if it is the
one that serves as the recordsource for your subreport.
In that report I've set the Formal Name as the Master Link & the
Child Link fields on the subreport data sheet.
Use the primary key and foreign key, which in this case, appears to be the
Company field from [CON-16] as the Link Master Field and the Company field
from the Issued table as the Link Child field.
If you still cannot get it to work, then I invite you to send me a compacted
and zipped copy of your database. You can use some fake company names if
needed. If you are interested, send me a private e-mail message with a valid
reply-to address. My e-mail address is available at the bottom of the
contributor's page indicated below. Please do not post your e-mail address
(or mine) to a newsgroup reply. Doing so will only attract the unwanted
attention of spammers.
Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
Karen said:
Hi Tom,
I think I understand all of this but maybe I've been unclear in my prior
explanation.
I have three tables: CON-16, Issued & Upcoming
CON-16 - Company is the primary key, also contains Formal Name as a field
Issued - seems to have no primary key, contains Company, contain Project
Number field
Upcoming - ID is the primary key, contains Project Number & Bid Opening Date
as fields
(When this database was set up, a formal name field and a company name field
were both created. the company name is a little more "informal" & my boss
doesn't want to change this. Also, the fact that there is no primary key in
Issued table was done before my time here.)
I've linked the tables for the main query. The connection is like this -
Company in Issued to Company in CON-16, Project Number in Issued & Upcoming.
It produces Formal names of all companies that have projects that fall before
a specified bid opening date. This query works perfectly.
For the secondary query I used the same three tables; it produces all Formal
names & their associated projects - no limitations.
I have a main report: It gives me the formal names of all companies that
have projects that fall before a specified date.
I have a subreport: It gives me all projects that are associated w/ the
formal names.
In that report I've set the Formal Name as the Master Link & the Child Link
fields on the subreport data sheet.
As I said before, the main report produces the correct formal companies but
the project numbers are not being limited to the right bid opening dates.
For instance: I have a company that has a bid opening date of 05/02/07. It
has no projects before this time. Rightfully so, it doesn't show up on the
report when I set the parameter to 04/30/07.
But I have a company that has projects w/ bid opening dates of 04/28/07 &
05/03/07. The report will not exclude the project dated 05/03/07 when I set
the parameter to 04/30/07. It always shows both projects.