Connecting Tech Pros Worldwide Forums | Help | Site Map

Importing data from excel via command button on a form.

Mr. Bungle
Guest
 
Posts: n/a
#1: Nov 12 '05
When importing excel from access I am fully aware that one can import
directly into a table. Can you get as specific via code or something
to import data from an excel sheet to a FORM (Not Table) through a
command button. For example: cell C5 on the selected excel spread
sheet = textbox2 in the current form.

This is for a service repair type database. The service technicians
work out in the field and currently create their service orders on an
excel spreadsheet which looks pretty for the customer but is not
nicely organized and table import friendly.

I would like for the user to be able to click on a command button and
import from the selected repair orders.

Is this even possible?

Thank you!

Pieter Linden
Guest
 
Posts: n/a
#2: Nov 12 '05

re: Importing data from excel via command button on a form.


slayer3600@hotmail.com (Mr. Bungle) wrote in message news:<aba497b8.0404062038.6d91f6@posting.google.co m>...[color=blue]
> When importing excel from access I am fully aware that one can import
> directly into a table. Can you get as specific via code or something
> to import data from an excel sheet to a FORM (Not Table) through a
> command button. For example: cell C5 on the selected excel spread
> sheet = textbox2 in the current form.[/color]

I think the best you can do is import the record and then go to it. A
form does not *hold* data, but just contains it. What I mean is that
a form cannot store data - only a table can.
[color=blue]
> This is for a service repair type database. The service technicians
> work out in the field and currently create their service orders on an
> excel spreadsheet which looks pretty for the customer but is not
> nicely organized and table import friendly.
>
> I would like for the user to be able to click on a command button and
> import from the selected repair orders.
>
> Is this even possible?
>
> Thank you![/color]

Import selected data? Umm... if you link to the spreadsheet and use
the spreadsheet (or a few of the columns) as the rowsource for a
multi-select listbox, maybe. then the user could select the records
he wants to import from the linked SS and import those... other than
that, I don't know how to do it...
MacDermott
Guest
 
Posts: n/a
#3: Nov 12 '05

re: Importing data from excel via command button on a form.


You can "automate" Excel from Access.

The easiest way is to add a reference to Excel to your mdb.
Then you can do something like this:
(WARNING: AIR CODE!)
Dim XL as new Excel.Application
XL.Workbooks.Add "C:\Spreadsheets\MyData.xls"
Me.Textbox2=XL.ActiveWorksheet.Range("$C$5")

There are a bunch of gotchas in this approach, so if you're serious about
it, I'd suggest you find some training in Automation.

HTH
- Turtle

"Mr. Bungle" <slayer3600@hotmail.com> wrote in message
news:aba497b8.0404062038.6d91f6@posting.google.com ...[color=blue]
> When importing excel from access I am fully aware that one can import
> directly into a table. Can you get as specific via code or something
> to import data from an excel sheet to a FORM (Not Table) through a
> command button. For example: cell C5 on the selected excel spread
> sheet = textbox2 in the current form.
>
> This is for a service repair type database. The service technicians
> work out in the field and currently create their service orders on an
> excel spreadsheet which looks pretty for the customer but is not
> nicely organized and table import friendly.
>
> I would like for the user to be able to click on a command button and
> import from the selected repair orders.
>
> Is this even possible?
>
> Thank you![/color]


Closed Thread