Share via

Numpty Blank Query Column

Phil S 261 Reputation points
2021-06-04T09:03:57.713+00:00

Hi all

I am looking to union some queries where the number of columns doesn't match.
Googling this gives responses generally in SQL/VBA which are not my forte.

Is there a way in the Access design window of introducing blank columns so that a union query will work?
Also, I am guessing that it would require different syntax if the blank column were unioning to a number column, text, date etc. column in the corresponding query.
Examples of the different types would be appreciated.

Many thanks

Phil

Microsoft 365 and Office | Access | Development
0 comments No comments

2 answers

Sort by: Most helpful
  1. Karl Donaubauer 3,356 Reputation points
    2021-06-04T16:52:31.94+00:00

    Hi,

    How do you create a UNION query without using SQL or the SQL view? ;-)

    Sure, you can also create the necessary/missing columns in the design window by writing sth like this in empty columns of the query grid:

    myText: Null
    or
    myNumber: Null
    or
    myDate: Null

    Where Null would be that you don't want to have a value in non existing field cases. You could also state a value of a fitting type instead of the Null.

    Servus
    Karl


    http://AccessDevCon.com
    https://www.donkarl.com

    Was this answer helpful?

    1 person found this answer helpful.

  2. DBG 11,711 Reputation points Volunteer Moderator
    2021-06-04T16:49:15.147+00:00

    Hi Phil. In the query designer, just add a new column like:

    Expr1: Null
    

    Was this answer helpful?

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.