473,387 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

transferring fields of worksheets in workbooks in a directory on my C: to an Access T

1
hi all,

problem:
transferring data from workbooks that are stored in a particular directory from excel to a table in access. when done, the workbooks that have been processed are automatically moved into a directory named “processed” . all using vba.

this is the pretty complex vb problem that i need some expert solution to.

overview.
i have created a cash reconciliation application in excel saved by month for each of my bus operator clients. when this cash reconciliation is completed this is saved to a certain directory. for illustrative purposes, i would have the following workbooks at any instance in a directory:

c:\\cashreconciliation

containing workbook files:
cashreconciliation of bribie for march 2007-05-15
cashreconciliation of sunbus for march 2007-05-15
cashreconciliation of caboolture for march 2007-05-15
cashreconciliation of clarks for march 2007-05-15


the layout of each workbook are exactly the same.

each tab in each workbook represents the days in a month. for example, for cashreconciliation of bribie for march 2007-05-15. worksheet1 is named 1st march 2007, worksheet2 is named 2nd march 2007 and so on……

each worksheet layout is identical, except they obviously contain different data corresponding to the relevant day.

each line between rows 8 to row 250 in each each worksheet contains data about each bus driver, their driver name, driver number, cash takings, adjustment amount, adjustment reasons, tickets sold, machine number(they use to issue tickets).


now here is the challenge.. i need some complex code that will go to each sheet (representing each day of the month)…. go to each record/line and upload each row of data contained in the excel columns named:

driver name, driver number, cash takings, adjustment reasons and tickets sold

to a table i created in access named : bus operator adjustments
(field names are the same i.e driver name, driver number, cash takings, adjustment reasons and tickets sold )

This whole process needs to be done for each workbook in the directory:

c:\\cashreconciliation

for example (as above):
cashreconciliation of bribie for march 2007-05-15
cashreconciliation of sunbus for march 2007-05-15
cashreconciliation of caboolture for march 2007-05-15
cashreconciliation of clarks for march 2007-05-15

once this vba code is run for each workbook, i would like each workbook automatically moved to :

c:\\cashreconciliation\processed

another request is to identify the most recent copied records from this whole process above in the table, using some sort of identifier like a temp file in access, then using vba, move it to the actual real file at any time., so we can do our own reconciliation. between workbooks and copied information.


That is briefly my problem identification. im a beginner vba programmer slowly getting better. need some help from anyone out there that has done something similar/ or someone that knows vba like a pro..

I done some research and know we can use ADO or the DoCmd.TransferSpreadsheet function.

I just don’t know how to actually write this synax and the best way to do this.

thankyou sooooo much in advance for reading this post and hopefully coming up with a solution for me..

thankyou again to all….
May 16 '07 #1
2 1807
Rabbit
12,516 Expert Mod 8TB
Why would you have to do it one element at a time? Can't you just import the entire excel table, do whatever you need to do with that table, and then move the file?

This can probably be done with 5-10 lines of code.
May 17 '07 #2
ADezii
8,834 Expert 8TB
hi all,

problem:
transferring data from workbooks that are stored in a particular directory from excel to a table in access. when done, the workbooks that have been processed are automatically moved into a directory named “processed” . all using vba.

this is the pretty complex vb problem that i need some expert solution to.

overview.
i have created a cash reconciliation application in excel saved by month for each of my bus operator clients. when this cash reconciliation is completed this is saved to a certain directory. for illustrative purposes, i would have the following workbooks at any instance in a directory:

c:\\cashreconciliation

containing workbook files:
cashreconciliation of bribie for march 2007-05-15
cashreconciliation of sunbus for march 2007-05-15
cashreconciliation of caboolture for march 2007-05-15
cashreconciliation of clarks for march 2007-05-15


the layout of each workbook are exactly the same.

each tab in each workbook represents the days in a month. for example, for cashreconciliation of bribie for march 2007-05-15. worksheet1 is named 1st march 2007, worksheet2 is named 2nd march 2007 and so on……

each worksheet layout is identical, except they obviously contain different data corresponding to the relevant day.

each line between rows 8 to row 250 in each each worksheet contains data about each bus driver, their driver name, driver number, cash takings, adjustment amount, adjustment reasons, tickets sold, machine number(they use to issue tickets).


now here is the challenge.. i need some complex code that will go to each sheet (representing each day of the month)…. go to each record/line and upload each row of data contained in the excel columns named:

driver name, driver number, cash takings, adjustment reasons and tickets sold

to a table i created in access named : bus operator adjustments
(field names are the same i.e driver name, driver number, cash takings, adjustment reasons and tickets sold )

This whole process needs to be done for each workbook in the directory:

c:\\cashreconciliation

for example (as above):
cashreconciliation of bribie for march 2007-05-15
cashreconciliation of sunbus for march 2007-05-15
cashreconciliation of caboolture for march 2007-05-15
cashreconciliation of clarks for march 2007-05-15

once this vba code is run for each workbook, i would like each workbook automatically moved to :

c:\\cashreconciliation\processed

another request is to identify the most recent copied records from this whole process above in the table, using some sort of identifier like a temp file in access, then using vba, move it to the actual real file at any time., so we can do our own reconciliation. between workbooks and copied information.


That is briefly my problem identification. im a beginner vba programmer slowly getting better. need some help from anyone out there that has done something similar/ or someone that knows vba like a pro..

I done some research and know we can use ADO or the DoCmd.TransferSpreadsheet function.

I just don’t know how to actually write this synax and the best way to do this.

thankyou sooooo much in advance for reading this post and hopefully coming up with a solution for me..

thankyou again to all….
I just want to make sure that I am crystal clear on exactly what you are requesting and illustrating:
  1. You have 4 Workbooks representing 4 bus operator clients.
  2. Each Workbook consists of 31 individual Worksheets named 1st March 2007, 2nd March 2007,...31st March 2007.
  3. The data from all 124 Worksheets has to transferred to and appended to an Access Table named Bus Operator Adjustments.
  4. Only Rows 8 through 250 on each Worksheet contain relevant data and need to be imported.
  5. Once an individual Workbook has been processed, it should automatically be moved to a Directory named C:\CashReconciliation\Processed.
  6. The most recently imported Records from this process need to somehow be uniquely identified, so that at any given time they can be moved back into the actual file so that you can perform your own reconciliation.
  7. Is this correct? Did I miss anything?
May 18 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: J Daniel Melton | last post by:
Hello, I am using late binding in a managed VC++ .NET 2003 application. I used KB 302902 (for C#) as a starting point and converted it to managed C++. I built a managed class that is intantiated...
1
by: kkbahuguna | last post by:
Dim Appxl as Excel.application Dim WBook as Excel.workbooks Dim WSheet as Excel.worksheet FileName = "c:\Temp\New.xls" Set Appxl=CreateObject("Excel.Application") Set WBook = Appxl.Workbooks...
0
by: kkbahuguna | last post by:
Dim Appxl as Excel.application Dim WBook as Excel.workbooks Dim WSheet as Excel.worksheet FileName = "c:\Temp\New.xls" Set Appxl=CreateObject("Excel.Application") Set WBook = Appxl.Workbooks...
3
by: mike11d11 | last post by:
I was able to create three worksheets in my workbook, but when I go to add the 4th I get an Invalid Index error. I must be leaving something out to when adding 4 or more sheets. Thanks Dim...
0
by: bfrank1972 | last post by:
I want to be able to get a list of all custom named fields in an Excel worksheet, but I am having trouble with this. In the code below, access to a field that I named "DEALCODE" works fine - I get...
17
by: ukchat | last post by:
I.m creating a dynamic query to pull out workbooks from my database the table structure is below. Table: curricworkbooks Columns: ID, curric, assessment, topic, workbook, filename Example data...
2
by: grego9 | last post by:
I have a problem in Excel 2000. I have written some VBA code that transfers data from the current excel workbook to a file called "Deal Input2.xls". Everything transfers ok apart from the date in...
7
by: Claudia d'Amato | last post by:
I would like to do something in a *.vbs script and all the operations should be applied on each worksheet within an Excel file. How do I do this? It must be something like: for i in (1 .....
1
by: MarkDotNet | last post by:
Hi I am trying to switch Excel worksheets in VBA. I get an error saying "subscript out of range". Please Help- Here is code (Fails on last 2 lines- Note that I ommited the recordset portion of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.