How to get specific data in VB

D

danijela.simunovic

Hi!
I am exporting some data from access to excel and here is my code for
that:

DoCmd.TransferSpreadsheet _
TransferType:=acExport, _
SpreadsheetType:=acSpreadsheetTypeExcel9, _
TableName:="Table1", _
FileName:=strFileName, _
HasFieldNames:=True, _
Range:="Sheet1"

But i would like to export just specific data from Table1. Let's say
only Dates that are in this year. Where do I put my contition for that
and how would the code go? Thanks!

Danijela
 
V

Van T. Dinh

Create a Query to filter only the Records/rows and Fields/columns you want
and use the Query name in the TableName argument of your code.
 
D

danijela.simunovic

I know that I can do it that way but then if I need 10 filters I would
need to make 10 querys or is there a way to give criteria from VB so
that one query can preform a job of 10 or more querys?
Thanks!

Danijela
 
D

danijela.simunovic

I did it!!!! Thanks! Don't need to explain! I made it work with one
query!
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top