PDA

View Full Version : Import Specific cells from Excel only selected date records.



Raj Kumar
02-27-2012, 01:07 AM
Hello ExcelFox community.

I am here now for a hep in Access. I had a wonderful help from this community. Here is my issue.

I am a newbie in Access. I am using Access 2007 version.

I have 3 tables. Sheet3Table, Sheet4Table, Sheet5Table

I have a excel file (xlsx) which use a separate file for everyday. This xlsx has 5 sheets. Sheet1 to Sheet5. I want import records from sheet3,4,5 to appropriate tables in Access, but based on the selected date.

Sheet3 7 Sheet4 has 10 columns. A:J
Sheet5 has 12 columns A:L

I will try to explain how to import.

I have a field in a form which is a text data format as date. So whenever I select a field will have a date picker. So I can select a date here.

When I click on Import button, need to ask for a file (exactly the same way like import external data in Access) So users can browse the file, then in that file look in Sheet3, Sheet4. If there is/are any records for the date selected in a date field, need to copy those records to appropriate tables. Column h is the date entered in xlsx file.

Copy range for Sheet3 & Sheet4

where is the selected date located in Sheet3 column H:Total nof records found for this selected date
A:J

Copy range for Sheet5,

where is the selected date located in Sheet5 column J:Total nof records found for this selected date
A:L

Import those records to Sheet3Table. same for Sheet4Table.

Eg: I select a date 2/21/2012

When I click Import ask for a file to browse, If the date is located in Sheet3!H20:H41, so copy A20:J41 to Sheet3Table,

In Sheet4 If the selected date is located in Sheet4!H50:H51, so copy A50:J51 to sheet4Table

In Sheet5, if the selected date is in Sheet5!J20:J60, so copy A20:L60 to Sheet5Table.

If the records is zero in a sheet msgbox No records found for the selected date.

I really appreciate your help.

I have cross posted this here (http://www.accessforums.net/showthread.php/22330-Import-Specific-cells-from-Excel-based-on-selected-file)

Raj