Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2002
    Posts
    5

    Cool Unanswered: Help with exporting data from a table only if records have been modified/added

    I am using TransferText but I am open to using anything else. I'm thinking maybe when the form is closed, that triggers the TransferText. Can you specify what data is to be exported to a text file?

    I don't need all records in the text file, only new or modified records. Please help!

  2. #2
    Join Date
    Apr 2002
    Location
    Portugal
    Posts
    146
    Althea,


    Add one filed more to that table, and set the data type for yes/no values.
    Now each time a record is modifyed, that field's value change to yes.
    Create a query, based on that table and restrict the exportation with criteria statments, only records that have "-1" which means "yes" are exported. New records should have "yes" to.
    Create another query, to change all values to "no", which means that they were exported.

  3. #3
    Join Date
    Apr 2002
    Posts
    5

    Help with exporting only current modified records

    Thanks! Now I'm having trouble getting only the modified records in the export. I created a second query but I'm having trouble using it. Every time I export, it retains the old modified data. Here is an example of my code: (The qryNoSpaces has criteria on 'modified' field set to -1)

    Private Sub Form_Close()

    DoCmd.TransferText acExportDelim, , "qryNoSpaces", _
    "C:\21010702.txt", False

    ?DoCmd.Requery "Modified"

  4. #4
    Join Date
    Apr 2002
    Location
    Portugal
    Posts
    146
    Althea,

    Can you be more specific!?

    When you say that, the query retains the old modified data!?

    Because if you set a predifined "YES" value in the yes/no field, each time you had a new record the field will have the yes value.
    If you change a existing record, by code you can change to value "YES".
    After exportation, run an action query, that changes all yes values to "NO".
    Now if you do not change or add a new record, if you run the query with the criteria seted to "YES", you do not see any record, which means that no records will be exported.

    To run an action query by code, just type:

    Docmd.OpenQuery "query_name"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •