Datepart Function

J

Jennifer

My manager suggested I use the datepart function to run what I need to,
however after reading posts, I'm very lost on what to do...
I am running an append query. The main table has the:
Vendor #, Store #, Doc Type(either Cr or Inv), the sum of the pay amt(based
on the type), and the last field is "Month". I added this field and updated
it to show 8/30/08.
My append query is appending the same fields, BUT.... I need to pull
information based on my entry date. I need a function that looks in the
"Month" column of my main table, and looks at the very last date ran
(8/30/08- at least for this month) and pulls everything greater than the
"month" date.

Any help?
 
K

Ken Snell \(MVP\)

DatePart is not the right function to use. From your post, it sounds as if
you want the maximum value from the Month field? In this case you can use a
subquery to use the Max aggregate function for filtering.

Please provide more details about exactly what you want to do, based on the
"maximum" date. It's confusing to me if you want a select query or an append
query, and which table(s) are involved.

Also, note that you should not name a field "Month". It and many other words
are reserved words in ACCESS and should not be used for control names, field
names, etc. Allen Browne (MVP) has a very comprehensive list of reserved
words at his website:

Problem names and reserved words in Access
http://www.allenbrowne.com/AppIssueBadWord.html


See these Knowledge Base articles for more information about reserved words
and characters that should not be used (these articles are applicable to
ACCESS 2007 as well):

List of reserved words in Access 2002 and Access 2003
http://support.microsoft.com/default.aspx?scid=kb;en-us;286335

List of Microsoft Jet 4.0 reserved words
http://support.microsoft.com/?id=321266

Special characters that you must avoid when you work with Access
databases
http://support.microsoft.com/?id=826763


See this site for code that allows you to validate your names as not being
VBA keywords:

basIsValidIdent - Validate Names to Make Sure They Aren't VBA Keywords
http://www.trigeminal.com/lang/1033/codes.asp?ItemID=18#18
 

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

Similar Threads


Top