Results 1 to 10 of 10
  1. #1
    Tony McGuire's Avatar
    Tony McGuire is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2009
    Location
    Denmark
    Posts
    14

    Month/Month to date

    I have created a data base which includes the 12 months of each year. For each month I have created 2 forms based on 2 seperate queries. Both forms contain the same 4 fields i.e. 'DueDate - Income - Expense - Balance. To the first form I have, under DueDate on the query side written the following criteria: Between 01-01-2011 and 31-01-2011 (the month of January) this shows all expected posts for the month of January for the complete month.

    For the second form i have changed the query wording slightly to read:
    Between 01-01-2011 and Now() this shows the posts from day to day as the month progresses however this can run into February and so on unless i change the criteria reading.

    Is there any way I can word the query so that it stops automatically at the end of the month?

    Tony McGuire

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Maybe, if you can answer this question: At the end of which month?

    What you describe seems more like what should be done in a report - grouping data by month.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    From what little you have posted about your mdb, it sounds like you might have a table for each year. This would be a bad design; all years should be in one table. Also, since the balance can be calculated at any time, you shouldn't store the balance in a table.

    To answer your question, in a query, add two columns. In the new columns add:
    Code:
    Field:       TheMonth: Month(DueDate)    TheYear:Year(DueDate)
    Criteria:               1                          2011
    If you wanted all entries for Jan, the criteria for TheMonth column would be 1 and the criteria for TheYear would be 2011.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Good catch, ssanfu, on the data structure. On re-read I can see that also. Agree, bad design.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Tony McGuire's Avatar
    Tony McGuire is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2009
    Location
    Denmark
    Posts
    14
    Quote Originally Posted by ajetrumpet View Post
    June,

    Do you report these posts? If not, you should be doing it. The amount of posts that show up in these FAQ forums is ridiculous. It is unneccessary clutter, and they need to be moved.

    thanks.
    Thanks for your help which was NO help. You should learn to suffer fools in silence. If anything should be removed then MAYBE it's you. You may be an expert but we beginners have to learn from the bottom! Do you take your lead from "June 7"?

    Have a nice day
    Clutterbug

  6. #6
    Tony McGuire's Avatar
    Tony McGuire is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2009
    Location
    Denmark
    Posts
    14
    Quote Originally Posted by June7 View Post
    Good catch, ssanfu, on the data structure. On re-read I can see that also. Agree, bad design.
    Maybe I'll learn in time about better designing etc,

    Anthony McGuire

  7. #7
    Tony McGuire's Avatar
    Tony McGuire is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2009
    Location
    Denmark
    Posts
    14
    Thanks for your quick reply.

  8. #8
    Tony McGuire's Avatar
    Tony McGuire is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2009
    Location
    Denmark
    Posts
    14
    Quote Originally Posted by June7 View Post
    Maybe, if you can answer this question: At the end of which month?

    What you describe seems more like what should be done in a report - grouping data by month.
    Does it really matter which month I am referring to?

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    What criteria determines the 'end of the month'? You state about the second query 'this shows the posts from day to day as the month progresses'. Do you want this query left alone? Is it the first query you want to automate? You can always calculate the previous month last day from the current date. Like: DateAdd("d",-1,CDate(Month(Date()) & "/1/" & Year(Date()))) or CDate(Month(Date()) & "/1/" & Year(Date()))-1 because the day interval is default. That what you are looking for?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    Tony McGuire's Avatar
    Tony McGuire is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2009
    Location
    Denmark
    Posts
    14
    Your answer credits investigation I wii try it and get back to you with the result.
    Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Current Month and Year-To-Date
    By DSnipeFunk in forum Access
    Replies: 4
    Last Post: 05-31-2011, 11:38 AM
  2. Date Comparison swapping month and day in VB
    By Mary Fall in forum Access
    Replies: 5
    Last Post: 04-21-2011, 06:31 AM
  3. Month To Date Query
    By jmorse in forum Queries
    Replies: 3
    Last Post: 03-11-2011, 11:25 AM
  4. Track capacity changes month by month
    By Nils in forum Database Design
    Replies: 1
    Last Post: 02-18-2011, 03:03 PM
  5. Replies: 5
    Last Post: 11-15-2010, 06:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums