Almost There

realnine

Registered User.
Local time
Today, 14:18
Joined
Jun 10, 2003
Messages
40
I have looked at the recent post concerning queries with date criteria and muddled through those from a search. From these I have learned a lot. I am almost where I want to be in my query. Here is the SQL

SELECT Dispatch.Date, Dispatch.Invoice, Dispatch.[PO Number], Dispatch.AmtBilled, Dispatch.AmtCredit, Dispatch.AmtPaid, Dispatch.Source
FROM Dispatch
WHERE (((Month(Dispatch!Date))=[type"EnterMonth:"]) And ((Year(Dispatch!Date))=[type"EnterYear:"]))
ORDER BY Dispatch.Invoice;

My question is how can I set the default month and year for the current month and year? This is a insigificant requirement but I want to learn how to do it for my own sake.

After I get this running I will attempt a lookup box for month and date as suggested in an answer to a previous post pertaining to getting a customeer name.

Thanks a lot and I hope I am not boring the experts with these novice questions.
 
You are using the word Date as the name of a field in your table. Date is a reserved word and you should change the field name to something else so Access does not get confused.

Month(Date()) and Year(Date()) will return the current month and current year.

Dim cMonth As Date
Dim cYear as Date

cMonth = Month(Date())
cYear = Year(Date())

hth,
Jack
 

Users who are viewing this thread

Back
Top Bottom