Results 1 to 6 of 6
  1. #1
    annie0219
    Guest

    Saving resutls of a query (access 97)

    Hi Again-
    I know I seem like a dumbass, sorry- but hopefully this is the last question-
    I need to figure out a way to save the results of a query. I am updating the table continuously, and after each update I want to run a query and save the results from the query- does any one know how to do this- Please Help!!!!!
    thanks in advance
    Annie

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Saving resutls of a query (access 97)

    You can save the results of the query in a new table by changing the query type to a Make Table query. In the design view of the query, click Query on the Menu Bar and then choose Make Table query. However, this is going to create a lot of tables if you are doing this continuously. If you explain what you are trying to accomplish, we might be able to come up with a more efficient method.

  3. #3
    annie0219
    Guest

    Re: Saving resutls of a query (access 97)

    Thank you for the suggestion. I am pulling out 1number from the table each time i run the query. the after the query is run and the number is saved, the original table is being changed and the process is being repeated. The only problem with creating a new table each time I run the query is that I will be doing this over 2500 times, so if you have any other suggestions or any thing else that I can do after the Make Table query, I would much appreciate the info- thanks again
    Annie

  4. #4
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Saving resutls of a query (access 97)

    Well, we clearly don't want to be creating 2500 tables. What is the purpose of this number you are pulling, changing and need to store? Are you trying to maintain some type of history? If that is the case, think about creating a history table, with the ChangeDate, the record identifier, the OldValue and the NewValue. You could append records to this table at each change and would be able to keep a history of updates.

  5. #5
    annie0219
    Guest

    Re: Saving resutls of a query (access 97)

    What's going on is that I am collecting data that is being taken from the back of a bus(data about speed of cars, how many targets, etc.). For each hour the bus is running, I get between 2000 and 3000 targets. And I have about 400 hours of data For each of these targets, I have to determine how useful they are to me. Each target that is found behind the bus is given its own csv file with all kinds of info in it. For right now only 1 piece of that info is interesting to me. Thus I have to access each file, run the query, save the result, and then clear the table, just to repeat this process for the whole thing. Most of the code I have written, which I will paste below, Bus I have to figure out how to save the numbers that I pull out with the query, before I clear the table to start a new file. If there is a way to do this easily so all of the numbers are very accessible I would appreciate it very much- thanks again-

    here is the code(everything works but I need to figure out how to save the results of the query)

    Function Run_Query()


    Dim f As String

    f = Dir("C:WinntProfilesacarrierDesktopTesting Database*" & "*_trk.csv")

    Do While f <> ""
    DoCmd.TransferText acImportDelim, "00000001 Link Specification", "Target_Information", "C:WinntprofilesacarrierDesktopTesting Database" & f

    Dim db As Database
    On Error Resume Next
    Set db = CurrentDb
    db.Execute "SELECT Target_Information.RANGE_RATE * FROM Target_Information * WHERE(([Target_Information]![RANGE_RATE] < 0))"

    db.Execute "DELETE * FROM Target_Information;"


    f = Dir
    Loop


    End Function

  6. #6
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Any other ideas on this?

    I believe that my prior answer still applies; after you select the valid reads, you want to append records to a table so that you have a "history" of the reads that have been taken. Each record in this table would be a separate read for a bus. Because your SELECT statement is SELECT *, I don't know which fields you are going to write to this table, but they should at least contain a BusIdentifier and ReadDate (you can make a multi-field key from this; you may need to add ReadTime if >1 read is taken per day), as well as any other data values you want to keep. You can write these records with an Append query (or an INSERT INTO statement), after the Select and before the Delete.
    Maybe someone else can give you other ideas if this is still not helpful to you ...

Posting Permissions

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