Solved

SQL UNION query as recordsource for a report

Posted on 1998-09-01
1
211 Views
Last Modified: 2006-11-17
I have a Union query, not too complex, which I am trying to use as a recordsource for a simple report. The query runs fine from the database window. When I specify it as the recordsource for the report, and try to run the report, I get the error message "Jet database engine could not execute the SQL statement because it contains a field that has an invalid datatype". The help file behind this message doesn't help me. Not sure how to debug this problem. All of the fields in the query have fields on the report. Each of the two queries that make up the UNION query work fine as the recordsource for the report! SOmething weird with the report not liking the UNION.
0
Comment
Question by:rjbryla
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
kulikuli earned 100 total points
ID: 1960935
Most probably there is a difference in datatypes between tables in the first and the second part of the queries that make up the union query. Check this first.
If you cannot find it this way then try removing a few fields(in both parts of the union) and try again running the report. You will find out which field causes the error. Then you are able to format it as you desire using the format function.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question