Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query does not work in report but works on it's own

Status
Not open for further replies.

splats

Technical User
Jan 2, 2003
131
My query works fine in SQL however it does not work in a report.

Here is the code:

SELECT [DCR Incidents].IncidNumber, Employee.EMPNO, Employee.NAME, Employee.OCCUPATION, Employee.STARTDATE, [DCR Incidents].*
FROM Employee INNER JOIN [DCR Incidents] ON Employee.EMPNO = [DCR Incidents].Empno
WHERE ((([DCR Incidents].IncidNumber)=[Forms]![frmEmployee]![sfrmDCRIncidents]![IncidNumber]) AND ((Employee.EMPNO)=[Forms]![frmEmployee]![EMPNO]))
ORDER BY Employee.NAME;


When I use it as a source for the report, it asks for a parameter for DCR Incidents.

It also does not show the subreport that is attached. The code of the subreport is:

SELECT [Employee].[EMPNO], [tblPreventions].[Prevention], [tblPreventions].[Completed], [tblPreventions].[CompletionDate], [tblPreventions].[TargetDate], [tblPreventions].[IncidNumber] AS tblPreventions_IncidNumber, [DCR Incidents].[IncidNumber] AS [DCR Incidents_IncidNumber]
FROM Employee INNER JOIN ([DCR Incidents] INNER JOIN tblPreventions ON [DCR Incidents].[IncidNumber]=[tblPreventions].[IncidNumber]) ON [Employee].[EMPNO]=[DCR Incidents].[Empno]
ORDER BY [tblPreventions].[CompletionDate];

funny thing is that the subreport query works great on it's own, but in the report it does not display.

any thought would be greatly appreciated.

Thank you

 
This is in Access 2000 and the code that I am showing you is from the query in SQL format.

Thank you
 
I'm not using Access, but for me, if a query works alone but not with the report, it usually means that some fields in the report do not match up with what the query is returning.

Just a thought.
 
Is forms!frmEmployee active when you attempt to run this query?

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'm not as think as you confused I am.
-----------
Flabbergasted (a.): Amazed at how much weight one has gained.
-----------
Oyster (n.): One who sprinkles their conversation with Yiddish expressions.
 
Plus, this question is better asked in an Access forum.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'm not as think as you confused I am.
-----------
Flabbergasted (a.): Amazed at how much weight one has gained.
-----------
Oyster (n.): One who sprinkles their conversation with Yiddish expressions.
 
tinat,

This is the Microsoft SQL Server: Programming forum, not the Microsoft Access forum. SQL Server's TSQL and Access' version of SQL (Jet-SQL???) are not fully compatible.

Please post your question on an appropriate forum.

-SQLBill

Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top