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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time Error 3307...

Status
Not open for further replies.

Chew407

Technical User
Mar 28, 2005
92
CA
I have taken over someone's db and I'm trying to get a certain report to generate. Everytime I click on the print button I get the run-time error 3307: The number of colums in the two selected tables or queries of a union query do not match. Is this one of those error messages that don't explain the actual problem or do the number of columns in both queries of the union query have to be the same? One of the queries has 10 columns while the other has only 5. Is this the real issue?
 
Yes, it is the real issue. You can use placeholders like '' in the portion with less columns to get it to work (just adding an empty column basically)

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
Thanks Alex,

I made both queries (crosstab) have 10 columns each but I still get the same error. The following is my union query:

SELECT * from qry_MaintDate UNION (Select * from qryRowDynamicTotals)
ORDER BY DisplayOrder;

Both crosstab queries are based on queries with multiple tables as their source. Does "Select * from the Union Query select all fields from those tables or just the fields selected for the crosstab queries?
 
Chew407

SELECT * FROM qry_MaintDate selects all fields from qry_MaintDate

SELECT * FROM qryRowDynamicTotals selects all fields from qryRowDynamicTotals

so if the qry_MaintDate has x columns then qryRowDynamicTotals should have the x amount of columns too.

PLUS fields of the same ordinal position should be of the same data type. I would suggest that you explicitly select in a specific order the fields from the above queries. Since you mention crosstab queries, you 'll have to ensure that row column shows always all necessary values (define them in the properties of that field), and force the other for the same count of fields.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top