Access to Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Excel
My Excel file has 12 tabs representing each month and year as follows
01-January-2005,02-February-2005;etc.
Predefined columns from A-F Date Ordered,Cost
Center,Quantity,Description,Date Received and Total Cost.

Database
Table- tblRequest
I would like to export the following fields from that table to the correct
tab,rows for the abov listed column.
Fiields:
dteDateOrdered,strCostCenter,lngQuantity,strDescription,dteDateReceived and
curCost.

I have a form where the user selects a month,Example 6 for June.
How do I write the code so that the correct data is entered into the correct
tab and rows for the columns listed above.

Currently there is no data in the file,but after data is entered,I don't
want to overwite it. How would I append the data.
 
You will need to use VBA code to do this. Since coding VBA for Excel is
quite verbose and you need to select a specific worksheet and cell to put the
data in, it would take too much space; however, I can offer some conceptual
help.
When you want to do the export, you will have to do the followint:
Create an instance of Excel.
Open the Workbook you want to put the data into.
Activate the Worksheet you need based on the date.
Locate and Activate the first empty cell in Column A (The first row after
the end of the current data).
Use the CopyFromRecordset method to move the data.
Save and close the workbook.
Destroy the instance of Excel you created.
 
Back
Top