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

    Accessing a Query (Access 97)

    I am writing code to run pull out information that i need from various files. Somewhere with in this code, I need to figure out a way to run a query that I have set up. Does anyone know how to access or run a query with in code? Please Help!!!!
    - The following is the code I am already using, basically, it pulls information from a file and updates a table, then when I am done with the info in the table, it clears the table. In between filling the table and clearing the table is when I need to access or run the query- Thanks in advance

    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 "DELETE * FROM Target_Information;"


    f = Dir
    Loop


    End Function

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Accessing a Query (Access 97)

    Hi,
    DoCmd.OpenQuery should do what you need. You can check out the syntax required for your particular needs in the help files.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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