Sub WhatLastOrder()
Dim LatestDate As Date
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Set dbs = CurrentDb()
Set qdf = dbs.QueryDefs("zzLatestOrder")
Set rst = qdf.OpenRecordset(dbOpenDynaset)
LatestDate = rst![LastOrder]
MsgBox LatestDate
rst.Close
End Sub
Sub WhatLastOrder()
Dim LatestDate As Date
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim prm As DAO.Parameter
Set dbs = CurrentDb()
Set qdf = dbs.QueryDefs("zzLatestOrder")
For Each prm in qdf.Parameters
prm.Value = Eval(prm.Name)
Next prm
Set rst = qdf.OpenRecordset(dbOpenDynaset)
LatestDate = rst![LastOrder]
MsgBox LatestDate
rst.Close
End Sub