views:

41

answers:

1

Hello,

Microsoft Access wants to be helpful and change my queries when underlying object (either form or query) does not exist.

For example, if I had a query that did the following...

SELECT FirstName
FROM persons

If the persons table does not exist yet, and I import the query, Access will place an "expr: " in front of FirstName signifying that it cannot find the column. This example table will be created with VBA later.

Is there a way to prevent Access from auto-correcting queries upon import?

Thanks!

+2  A: 

Change the query to specify the aliases

SELECT FirstName AS FirstName
FROM Persons

This will prevent MS Acces from creating an alias for you. (Stupid I know, but it works.)

astander
That addresses the example but not the general question. The Access UI screws up the SQL in saved database objects in other ways e.g. http://stackoverflow.com/questions/1706383/prevent-access-screwing-up-queries-it-cant-understand-when-switching-to-design-m
onedaywhen