populate excel worksheet from qdf.openrecordset

Posted on 2012-08-15
Last Modified: 2012-08-15
I have passed parameters to a query in access and I now want to populate a worksheet with the values (rows) from that qdf.OpenRecordset but not sure how

      qdf.Parameters("[Yes=CW Codes/No=SMMT Codes]").Value = codetype
        qdf.Parameters("[Enter Cars, Bikes, Lcv, Others]").Value = VehicleCat
        qdf.Parameters("[Yes=Matched Abi/No=No Match Abi]").Value = True
        qdf.Parameters("[Yes=Matched Cap/No=No Match Cap]").Value = Null
        qdf.Parameters("[Yes=Matched Glass/No=No Match Glass]").Value = Null
        qdf.Parameters("[Yes=Matched Adl/No=No Match Adl]").Value = Null
        qdf.Parameters("[Yes=Matched Insecom/No=No Match Insecom]").Value = Null
        qdf.Parameters("[Yes=Matched Techdoc/No=No Match Techdoc]").Value = Null
        qdf.Parameters("[Yes=Matched Halfords/No=No Match Halfords]").Value = Null
        qdf.Parameters("[Yes=Matched Kee/No=No Match Kee]").Value = Null
        qdf.Parameters("[Yes=Matched Vivid/No=No Match Vivid]").Value = Null
        qdf.Parameters("BYM") = SelectedMonth

Open in new window

Question by:PeterBaileyUk
    LVL 85

    Accepted Solution

    assuming a recordset variable called rst, use:

    Activesheet.range("A2").copyfromrecordset rst

    Open in new window


    Author Comment

    how can i clear the range before i grab the recordset to clear previous recordsets?
    LVL 85

    Expert Comment

    by:Rory Archibald

    should do it.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Suggested Solutions

    Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
    Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
    Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
    The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now