TransferSpreadsheet - If empty do not export

S

StephanieH

I'm using TransferSpreadsheet to run several queries to a single spreasheet
so that each query has it's own tab in the spreadsheet. Sometimes, some of
the queries are empty. Is it possible to specify that if the query is empty,
do not export?
 
K

Klatuu

Dim rst As Recordset

Set rst = Currentdb.OpenRecordset("MyQueryName")

If rst.Recordcount < 1 Then
MsgBox "No Records For This Query"
Else
DoCmd.TransferSpreadsheet......
End If
 

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