Results 1 to 2 of 2
  1. #1
    shabbaranks is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    162

    How do I Export only new records to CSV

    Hi,

    I was wondering if anyone could help please? Im trying to create an export which exports only newly added records from a table to a csv. Currently I have a query which links to the code below and exports all records.

    Code:
    Private Sub ExportCSV_Click()
        Dim strPasswd
        strPasswd = InputBox("Enter Password", "Restricted Form")
        If strPasswd = "" Or strPasswd = Empty Then
            MsgBox "No Input Provided", vbInformation, "Required Data"
            Exit Sub
        End If
        If strPasswd = "********" Then
       DoCmd.OutputTo acOutputQuery, "ExportCSVQuery", "MicrosoftExcel(*.xlsx)", "N:\Database\Output.csv", False, ""
        Else
            MsgBox "Sorry, you do not have access to this function", _
                   vbOKOnly, "Important Information"
            Exit Sub
        End If
    End Sub
    Would I need to add some sort of flag which indicates that a record has been exported alreasy or is there another method?

    Thanks

  2. #2
    Stingaway is offline Efficiency Junkie
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Location
    The deep south. Keep going until you hit water basically.
    Posts
    224
    Use the query that you have already, filter out the new records through the query and then export using the same code. Or you could save a modified filtered query off as a new records only query and just run it against that query instead...

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

Similar Threads

  1. Access 2007 - Creating New Records Based on Existing Records
    By GeorgeAugustinePhillips in forum Forms
    Replies: 9
    Last Post: 10-05-2011, 05:58 PM
  2. Replies: 12
    Last Post: 08-30-2011, 03:36 PM
  3. Export multiple records based on a field
    By dskulman in forum Import/Export Data
    Replies: 0
    Last Post: 03-03-2011, 02:44 PM
  4. export multiple reports based on table records
    By steve2000 in forum Reports
    Replies: 3
    Last Post: 10-03-2010, 03:44 PM
  5. Export single records to new Word Document
    By karmaimages in forum Import/Export Data
    Replies: 0
    Last Post: 11-19-2009, 03:37 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