Import form code

  • Thread starter Thread starter Tony Wainwright
  • Start date Start date
T

Tony Wainwright

Hi guys,

I have a small Access 2K application that is to be used offsite at a subsidiary company. At the moment I have to go to the company, delete the forms/reports that I have changed and use the File|Get External Data|Import... wizard.

What I would like to do is be able to do this via code which would be attached to a button on the switchboard. I would send the update to the subsidiary by email.
The order of operations would be:-

1) User to select the location of the update file
2) User to choosing which object to import
3) Application to delete the current objects in the application
4) Application to import the chosen objects.

Can anyone give me pointers on how to do this?

Cheers
Tony
 
Tony, split your mdb into back end (tables only) and front end (all other
objects, and attached tables).

You can then send them an update to the front end, and they can simply
replace their existing front end with the new one.

More information:
http://allenbrowne.com/ser-01.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi guys,

I have a small Access 2K application that is to be used offsite at a
subsidiary company. At the moment I have to go to the company, delete the
forms/reports that I have changed and use the File|Get External
Data|Import... wizard.

What I would like to do is be able to do this via code which would be
attached to a button on the switchboard. I would send the update to the
subsidiary by email.
The order of operations would be:-

1) User to select the location of the update file
2) User to choosing which object to import
3) Application to delete the current objects in the application
4) Application to import the chosen objects.

Can anyone give me pointers on how to do this?

Cheers
Tony
 
Thanks Terry I've already done this. I think I haven't explained myself
properly. I don't want to just send a new front end as the front end has to
contain a table (I know I shouldn't but circumstances have dictated that I
must) that would be upset by just overwriting with a new front end.
 
In that case, you have some code to write.

You could create an "updater" mdb which modifies the existing application.

Your step 1: For the user to locate the file, see:
http://www.mvps.org/access/api/api0001.htm

Your step 2: I wouldn't give them this option. Your updater should contain
only what they need, as an all-or-nothing operation. It would be possible to
create an interface where the user selects which parts to update, but I
don't see the point.

Your step 3: OpenDatabase into the file the user selected in step1. You can
then delete the objects.

Your step 4: DoCmd.CopyObject allows you to specify the destination
database.
 
Thanks Allen,
That's exactly what I was looking for.
Just one other thing - would this work if the front-end was an mde?
Tony
 
Tony,

How about putting the table in a separate .mdb file and linking to it in the
frontend. You could then do what Allen suggested when there are changes to the
frontend. If you need to send them an update of the table, you would send it as
a separate file.
 
Tony said:
I think I haven't explained myself
properly. I don't want to just send a new front end as the front end has to
contain a table (I know I shouldn't but circumstances have dictated that I
must) that would be upset by just overwriting with a new front end.


I do this kind of thing with an updater program that renames
the old version of the frontend mdb, copies the new version
into their directory and then runs an Insert Into query to
copy the old frontend table's contents to its corresponding
table in the new frontend.
 
Back
Top