Solved

SQL UNION query as recordsource for a report

Posted on 1998-09-01
1
216 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

707 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