VBA equal of a SQL phrase

  • Thread starter Thread starter Art Vandaley
  • Start date Start date
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=
........
 
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)
 
Back
Top