?
Solved

populate excel worksheet from qdf.openrecordset

Posted on 2012-08-15
3
Medium Priority
?
439 Views
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

0
Comment
Question by:PeterBaileyUk
  • 2
3 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 2000 total points
ID: 38295509
assuming a recordset variable called rst, use:

Activesheet.range("A2").copyfromrecordset rst

Open in new window

0
 

Author Comment

by:PeterBaileyUk
ID: 38295553
how can i clear the range before i grab the recordset to clear previous recordsets?
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 38295561
Range("a2").currentregion.clearcontents

should do it.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

807 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