Forms based on a query

  • Thread starter dksj67 via AccessMonster.com
  • Start date
D

dksj67 via AccessMonster.com

Hello,

I created a query based on an inner join between two tables:

SELECT Panels.[Panel Name] AS [Panels_Panel Name], Panels.BreakerCt, Panels.
[Location Name], Panels.[Panel Building Number], Panels.[EMTS Number], Panels.
Source, Panels.Manufacturer, Panels.[Main Breaker Rating], Panels.[Main Bus
Rating], Panels.Trim, Panels.[Catalog Number], Panels.Voltage, Panels.
[Enclosure Type], Panels.Phase, Panels.Mounting, Panels.[Main Lugs Only],
Panels.[Notes:], [Panel Circuits].ID AS [Panel Circuits_ID], [Panel Circuits].
CircuitID, [Panel Circuits].[Circuit#], [Panel Circuits].[Panel Name] AS
[Panel Circuits_Panel Name], [Panel Circuits].[Layout Type], [Panel Circuits].
[Breaker Continuous Amps], [Panel Circuits].[Circuit Name], [Panel Circuits].
[A Loading (Watts)], [Panel Circuits].[B Loading (Watts)], [Panel Circuits].
[C Loading (Watts)]
FROM Panels INNER JOIN [Panel Circuits] ON Panels.ID=[Panel Circuits].[Panel
Name]
WHERE (((Panels.[Panel Name])=Forms!PanelLocations!Combo33));

The name of the query is "Panels Print Select".

The query runs just as it should. But then I reference this query in a form
and a report. The form's record source property says:

SELECT [Panels Print Select].[Panels_Panel Name], [Panels Print Select].
BreakerCt, [Panels Print Select].[Location Name], [Panels Print Select].
[Panel Building Number], [Panels Print Select].[EMTS Number], [Panels Print
Select].Source, [Panels Print Select].Manufacturer, [Panels Print Select].
[Main Breaker Rating], [Panels Print Select].[Main Bus Rating], [Panels Print
Select].Trim, [Panels Print Select].[Catalog Number], [Panels Print Select].
Voltage, [Panels Print Select].[Enclosure Type], [Panels Print Select].Phase,
[Panels Print Select].Mounting, [Panels Print Select].[Main Lugs Only],
[Panels Print Select].[Notes:], [Panels Print Select].[Circuit#], [Panels
Print Select].[Layout Type], [Panels Print Select].[Breaker Continuous Amps],
[Panels Print Select].[Circuit Name], [Panels Print Select].[A Loading (Watts)
], [Panels Print Select].[B Loading (Watts)], [Panels Print Select].[C
Loading (Watts)] FROM [Panels Print Select];

Now, when I run the query from the form or report a dialogue box comes up
with asking form me to enter "ID". I am guessing that it is refering to the
ID autonumber field on the Panels table (Panels.ID) in the inner join
statement above:

FROM Panels INNER JOIN [Panel Circuits] ON Panels.ID=[Panel Circuits].[Panel
Name]

Why is this box coming up? If I dont enter anything into it and press ok it
runs the form or report just as designed. The box is a nuisance and looks
shoddy. thanks

Dan Kreiling
 
K

Klatuu

Include the ID field in the query and in the form's recordset.
--
Dave Hargis, Microsoft Access MVP


dksj67 via AccessMonster.com said:
Hello,

I created a query based on an inner join between two tables:

SELECT Panels.[Panel Name] AS [Panels_Panel Name], Panels.BreakerCt, Panels.
[Location Name], Panels.[Panel Building Number], Panels.[EMTS Number], Panels.
Source, Panels.Manufacturer, Panels.[Main Breaker Rating], Panels.[Main Bus
Rating], Panels.Trim, Panels.[Catalog Number], Panels.Voltage, Panels.
[Enclosure Type], Panels.Phase, Panels.Mounting, Panels.[Main Lugs Only],
Panels.[Notes:], [Panel Circuits].ID AS [Panel Circuits_ID], [Panel Circuits].
CircuitID, [Panel Circuits].[Circuit#], [Panel Circuits].[Panel Name] AS
[Panel Circuits_Panel Name], [Panel Circuits].[Layout Type], [Panel Circuits].
[Breaker Continuous Amps], [Panel Circuits].[Circuit Name], [Panel Circuits].
[A Loading (Watts)], [Panel Circuits].[B Loading (Watts)], [Panel Circuits].
[C Loading (Watts)]
FROM Panels INNER JOIN [Panel Circuits] ON Panels.ID=[Panel Circuits].[Panel
Name]
WHERE (((Panels.[Panel Name])=Forms!PanelLocations!Combo33));

The name of the query is "Panels Print Select".

The query runs just as it should. But then I reference this query in a form
and a report. The form's record source property says:

SELECT [Panels Print Select].[Panels_Panel Name], [Panels Print Select].
BreakerCt, [Panels Print Select].[Location Name], [Panels Print Select].
[Panel Building Number], [Panels Print Select].[EMTS Number], [Panels Print
Select].Source, [Panels Print Select].Manufacturer, [Panels Print Select].
[Main Breaker Rating], [Panels Print Select].[Main Bus Rating], [Panels Print
Select].Trim, [Panels Print Select].[Catalog Number], [Panels Print Select].
Voltage, [Panels Print Select].[Enclosure Type], [Panels Print Select].Phase,
[Panels Print Select].Mounting, [Panels Print Select].[Main Lugs Only],
[Panels Print Select].[Notes:], [Panels Print Select].[Circuit#], [Panels
Print Select].[Layout Type], [Panels Print Select].[Breaker Continuous Amps],
[Panels Print Select].[Circuit Name], [Panels Print Select].[A Loading (Watts)
], [Panels Print Select].[B Loading (Watts)], [Panels Print Select].[C
Loading (Watts)] FROM [Panels Print Select];

Now, when I run the query from the form or report a dialogue box comes up
with asking form me to enter "ID". I am guessing that it is refering to the
ID autonumber field on the Panels table (Panels.ID) in the inner join
statement above:

FROM Panels INNER JOIN [Panel Circuits] ON Panels.ID=[Panel Circuits].[Panel
Name]

Why is this box coming up? If I dont enter anything into it and press ok it
runs the form or report just as designed. The box is a nuisance and looks
shoddy. thanks

Dan Kreiling
 
D

dksj67 via AccessMonster.com

I tried that. I typed "Panels.ID" into the SELECT statement of the first
query and ran the query and the ID showed up in the results. I went into
Design View, cleared the "Show" checkbox for Panels.ID and Access
automatically deleted Panels.ID from the SQL statement. If I am not
interested in this field then why to I have to SELECT it?

Include the ID field in the query and in the form's recordset.
[quoted text clipped - 47 lines]
Dan Kreiling
 
K

Klatuu

Because it it the primary key field of records you will be adding and it
needs a place to put them and because it is used in the base query to join
the tables.
--
Dave Hargis, Microsoft Access MVP


dksj67 via AccessMonster.com said:
I tried that. I typed "Panels.ID" into the SELECT statement of the first
query and ran the query and the ID showed up in the results. I went into
Design View, cleared the "Show" checkbox for Panels.ID and Access
automatically deleted Panels.ID from the SQL statement. If I am not
interested in this field then why to I have to SELECT it?

Include the ID field in the query and in the form's recordset.
[quoted text clipped - 47 lines]
Dan Kreiling
 

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