Results 1 to 7 of 7
  1. #1
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287

    check to see if an append query has been run

    Hey guys,



    I am pretty stumped on this one. I have a table of data. Every week, on a Monday, an append query must be ran for the previous Monday-Sunday period. For instance, on 12/30 I will run the query for 12/23 - 12/29. That query can be ran anytime, not just on that Monday.

    I want a pop-up to appear on load of my main form asking if the user wants to run the query. If yes, run it (takes about 3 minutes), if not just close the dialog box and ask again next time the form loads. I don't want this pop up to appear if the query has been be ran for the previous week already.

    How can I code a statement to check if last weeks data is already in the table?

    I can handle all of the dialog box code and all that. I just need the if/then bit to check if the data has been ran.

    Here is a snippet of the table:
    Click image for larger version. 

Name:	dotstable.PNG 
Views:	13 
Size:	22.4 KB 
ID:	14859

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You could do a DCount looking for the previous Sunday's date. A formula like this should find that:

    Date - Weekday(Date, vbMonday)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    Never done a DCount. Could you elaborate a bit?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Same syntax as DLookup(). In code:

    Code:
    If DCount(...) > 0 Then
       it's already been run.
    Else
      it hasn't
    End If
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    Ah nice. Makes sense. I'll see if I can get this to work.

    Appreciate it bud!

  6. #6
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    Working great! Thanks again man!

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Append Query
    By buckwheat in forum Access
    Replies: 16
    Last Post: 08-01-2013, 04:32 PM
  2. Mass Append using check boxes
    By brow1726 in forum Forms
    Replies: 9
    Last Post: 12-13-2012, 12:36 PM
  3. Replies: 1
    Last Post: 10-06-2011, 08:37 AM
  4. Replies: 7
    Last Post: 07-21-2011, 01:01 PM
  5. Append query won't append
    By yelkenli in forum Queries
    Replies: 5
    Last Post: 02-12-2010, 11:19 AM

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