Data Transfer

mfm

New member
Local time
Tomorrow, 00:32
Joined
May 20, 2009
Messages
8
Hello to everyone. Office 2007

I have a database name "medb" which contain two forms name "reportshow" and "importdata" what i want is to import some data from excel sheet. into my database table which is already created and some data already. importdata contain one button and textbox. Textbox contains the name of the excel file and button offcourse bind to code which imports data
how can i connect to that excel sheet and get the data into my table named "thename"

Data format in excel sheet is

1stColumn | 2ndColumn | 3rdColumn
Name | Lastname | Age
 
you can use the docmd.transferspreadsheet command. More info can be found in the vba help :)
 
You could link the spreadsheet to your database, either the whole sheet or a named area if it is just a few cells you want.
This makes a table in your db with the spreadsheet data in it.

Then you can take the data from that into your other table on the click of your button

pnb
 
oK but i have one more question i don't know the exact range like A1: D12 it can vary so i declare A1: d50 does it also imports the blanks or it will only import the data which have some values in the declare range. ?
 
If you don't know the exact cells how do you know which ones to transfer into the other table?
Yes blanks will come across. Col headers as field names and all the data in the range you have used.
Just try it, it is very easy and you will see what you have.

One other 'trick' is to have the cells you want in the ss copied to the some other cells, also in the ss, but fixed references, then you only have to link to them.

Hope that helps

pnb
 

Users who are viewing this thread

Back
Top Bottom