Access to Excel (Don't Want to overwrite)

drmojo418

New Member
Joined
Apr 12, 2005
Messages
8
i have a form that has a button that when clicked send the info from my query:

here is the sql code for my qry.
SELECT dbo_InventoryFairfield.CRCallDateTime, dbo_InventoryFairfield.ArrivlDate, dbo_InventoryFairfield.CRCallResultCode, dbo_InventoryFairfield.Office, dbo_InventoryFairfield.FirstName, dbo_InventoryFairfield.MiddleInt, dbo_InventoryFairfield.LastName, dbo_InventoryFairfield.SpouseName, dbo_InventoryFairfield.Address, dbo_InventoryFairfield.City, dbo_InventoryFairfield.State, dbo_InventoryFairfield.Zip, dbo_InventoryFairfield.CRAreaCode, dbo_InventoryFairfield.CRExchange, dbo_InventoryFairfield.CRNumber, dbo_InventoryFairfield.BusPhone, dbo_InventoryFairfield.Rate, dbo_InventoryFairfield.VfrCamp, dbo_InventoryFairfield.NoAdults, dbo_InventoryFairfield.NoKids, dbo_InventoryFairfield.Comments1, dbo_InventoryFairfield.CcAmt1, dbo_InventoryFairfield.CcAmt2, dbo_InventoryFairfield.CcAuthorize1, dbo_InventoryFairfield.CcAuthorize2, dbo_InventoryFairfield.CrsID2, dbo_InventoryFairfield.Email, dbo_InventoryFairfield.CRAgentID, dbo_InventoryFairfield.VfrID
FROM dbo_InventoryFairfield
WHERE (((dbo_InventoryFairfield.CRCallDateTime)>[Start Date mm/dd/yy] And (dbo_InventoryFairfield.CRCallDateTime)<[End Date mm/dd/yy]) AND ((dbo_InventoryFairfield.CRCallResultCode) Like "S*") AND ((dbo_InventoryFairfield.Office) Like "SD"));

and here is the code for my onclick event for my button. (which when clicked being that it comes from the same code as the form it asks for a start and end date)

here is the vb code:

Function SD_exportToExcel()

DoCmd.TransferSpreadsheet transfertype:=acExport, _
spreadsheettype:=acSpreadsheetTypeExcel9, _
tablename:="qrySD_Sales", _
filename:="C:\MY DOCUMENTS\SD_dailySales.xls", _
hasfieldnames:=True

End Function

The function listed above works but it overwrites the old spreadsheet. i need to just append the data to the previous spreadsheet. could someone help me with this.

thanks
chad
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Transfer the data to a worksheet, then have a macro in excel to append the data from that worksheet to your data sheet.
 
Upvote 0

Forum statistics

Threads
1,223,261
Messages
6,171,076
Members
452,377
Latest member
bradfordsam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top