VBA equal of a SQL phrase

A

Art Vandaley

Hi,

SELECT Max([table1].[field1]) AS [MaxOffield1]
FROM [table1] IN 'C:\trial.mdb';

Can anybody please translate above things to VBA for me? Best Regards.

PS: I need to assign the result (it is an integer) to a variant like Y=
........
 
G

Guest

If you have the posted SQL as a saved Query, you can simply use the DLookUp()
function like:

Y = DLookUp("[MaxOfField1]", "YourQuery")

Check Access VB Help on the DLookUp() function.

HTH
Van T. Dinh
MVP (Access)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top