On Jul 9, 8:38*pm, Jey <J...@discussions.microsoft.com> wrote:
> I want to design a tool to import data from an excel workbook with multiple
> tabs into multiple tables in a database. The excel sheet will be used for
> field staff to enter data into, and will be set up ahead of time so it will
> be consistant as far as field names etc. They specifically want excel (I
> tried to sell them on the idea of distributing a data entry package in
> access, but they didn't go for it!).
>
> Most importantly I want the tool to validate the data first and give the
> user a chance to fix any entries that don't match the data type of the field
> it is supposed to be going to! I want the basic flow to be:
> -allow the user to navigate to the file they want to import
> -check the data
> -if the data has problems, generate a report for the user
> -if the data is OK, proceed with importing it
> (but I'm open to alternate suggestions!)
>
> I basically want it to do what the 'import from excel' wizard does, but
> multiple times per workbook with the tab & table selections automated, and
> with a detailed error report generated in case of a failure to import! Plus
> some 'pre-import' formatting on the excel sheet (ex. converting all formulas
> to values). The other complication is that some data from one tab will have
> to be copied to multiple records on subsequent tabs. For example tab1 has
> weather data for the day, creating 1 record in table1. The ID of that record
> created in the database has to go into a field for each record on tab2/table2.
>
> I'm fairly new at VBA, so I'm having trouble even getting started. I'd
> appreciate it if someone could give me some ideas on what might work for the
> various steps?
>
> Thanks,
> Jey
I hate to say this, but Access is much better at validation as the
data is entered than Excel is. This is going to be a serious hassle.
This would be pretty straightforward in Access. Create your tables,
enforce Referential Integrity, create validation rules for the fields
you need to, and you're pretty much done. The code, if you need any,
would be relatively minor. I get the feeling that this will be
anything but that - IMO, Excel is the wrong tool for the job.
|