简体   繁体   中英

As keyword SQL VBA

I was looking at SQL statement for an example database which went something like this'

SELECT INDEX, SUM AS Total FROM INVD WHERE INV=[Forms]![ENTRY].[INV]

What does AS mean on the code above?

Also is me.Entry same as [Forms]![ENTRY]

The key word AS indcates, that you want to use an alias for your column name.

SELECT Sales FROM Table1 'The column name in the output query will be Sales

SELECT Sales As Money FROM Table1 'The column name in the output query will be Money

To your second question it is not the same. If Form1 is the active form and you use me.ID it will be the same like Form1!ID . Same when Form2 is the active form and you use me.ID it will be Form2!ID . So .me refers always to the active form. But when you use Forms!Form2!ID it will always look for Form2 even when Form1 is the active form.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM