I don't understand your question as stated. If you want to use something in a query, I think you need to create a function.
Here is the procedure set up as a function. You have to pass a parameter eith "Last" or "Current" to get the respective Date.
There is a test routine at the end of the function.
Code:
'---------------------------------------------------------------------------------------
' Procedure : j20120611
' Author : Jack
' Date : 11/06/2012
' Purpose : To provide the Last Friday in the month associated with a supplied Date, and
' the Last Friday in the previous month
'
'Parameter "Last" to get last month's last Friday
' "Current" to get this month's last Friday
'---------------------------------------------------------------------------------------
'
Function j20120611(WhichMonth As String) As Date
Dim mydate As Date
Dim LastFridayThisMonth As Date
Dim LastFridayLastMonth As Date
10 On Error GoTo j20120611_Error
20 mydate = Date 'set up for specific request - based on today's date
'This will work with a supplied Date as MyDate
' "23/21/4/3" '#1/45/2002# 'for testing #6/11/2012# #12/24/2012#
30 If IsDate(mydate) Then
40 LastFridayThisMonth = DateAdd("d", 1 - DatePart("w", DateSerial(Year(mydate), Month(mydate) + 1, 0), 6), DateSerial(Year(mydate), Month(mydate) + 1, 0))
50 LastFridayLastMonth = DateAdd("d", 1 - DatePart("w", DateSerial(Year(mydate), Month(mydate), 0), 6), DateSerial(Year(mydate), Month(mydate), 0))
60 If WhichMonth = "Current" Then j20120611 = LastFridayThisMonth
70 If WhichMonth = "Last" Then j20120611 = LastFridayLastMonth
80 Else
90 MsgBox "No valid Date supplied...Error....Try again", vbOKOnly
100 End If
110 Debug.Print "This month " & LastFridayThisMonth & vbCrLf & "Last month " & LastFridayLastMonth
120 On Error GoTo 0
130 Exit Function
j20120611_Error:
140 If Err.number = 13 Then
150 MsgBox " You did not enter a Date datatype ....type mismatch"
160 Else
170 MsgBox "Error " & Err.number & " (" & Err.Description & ") in procedure j20120611 of Module AWF_Related"
180 End If
End Function
Code:
Sub testj20120611()
Debug.Print "LastMonth Last Friday was " & j20120611("Last")
Debug.Print "ThisMonth Last Friday will be " & j20120611("Current")
End Sub