Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to email a table as an attachment?

Status
Not open for further replies.

JennyPeters

Programmer
Oct 29, 2001
228
0
0
US
I've recently been asked send all the data from a DB that I made in one branch of a company to the same type of DB they are using in another branch of the company, in order to consolidate all the data in one place. These branches are not hooked up over the internet or intranet, so the only way to do it is to send a table from one DB to the other and import the data...

What is the best way to do this?

Jenny
 
I just did this a couple days ago.

To start off, i created a macro using the SendObject action then filled in the fields it asked for.
Then I went to tools-macro-convert macro to visual basic, and it will convert to vb so you can fiddle around with it.

Heres what i ended up with

Dim strEmail As String
If [Forms]![Customers]![Problem Entry]![Customers_Pending] = "1" Then

strEmail = DLookup("email", "Technician", "[Tech Name]= '" & [Forms]![Customers]![Problem Entry]![Assigned To] & "'")
MsgBox (strEmail)
DoCmd.SendObject acReport, "unresolved trouble calls", "SnapshotFormat(*.snp)", strEmail, "", "", "trouble calls", "", False, ""
End If

DoCmd.Close

It's conditional, only sending an email if a radiobutton is clicked.

It then goes and looks up who it was assigned to in a combo box'assigned to' and find the email. I also made the report it was sending customized based on who it was assigned to. You're probably looking for somthing a little simpler, but just thought i'd pass on the knowledge. Sam Greene
anyone in need of a rock induced headache? if so
 
Ah, but you are sending a snapshot, and not an actual table or .mde file. Can you send a table or .mde file using this code you have mentioned above?

Jenny
 
Jenny,
You can output RTF,excel,txt,iis,asp's and html ,at least thats what's availiable in the macro builder.
You could use excel and then import to whatever you are doing. I couldn't find all the output types on the MS
site, so I'm not sure if you can send a table file. But if you are emailing a table and then importing it into
a db, importing an excel spreadsheet takes no longer. What exactly are you doing?? Sam Greene
anyone in need of a rock induced headache? if so
 
Think simple- real simple - create a database with just that table in it. Email the person who needs the table, attach the single table database as an attachment. They get your data in the db then they simply import the table. Simple is best.
 
I like your idea Jane. Is there a direction you could lead me in creating a DB while still in a DB?

Thanks greatly,

Jenny
 
YOu can create a new dB and then import the table to the new one. It allows you to select what ever you want to import, from one table to all queries
 
HAVE YOU TRIED THE SENDOBJECT ACTION IN A MACRO.
 
Jenny,
I was under the impression you wanted to send the info from access, not from an email client. Even creating a DB by itself and then importing into access, you go through the same steps. So just create the macro, tell it to output excel, then import into whatever db you need to. SIMPLE :) Sam Greene
anyone in need of a rock induced headache? if so
 
I had heard of a problem of text truncation of memo fields when a table is changed from Access to excel. That is why I was suggesting staying in one format. Yes if you are going to do something endless times figure out a way to do it programatically but this sounds like a one time project where simplicity and keeping the same format is best.
Of course I may be oversimplifying....
 
I will actually need to have it done by 10 programs every month, all sending data to one main DB. I was hoping to put a whole lot of code in one button that creates the DB, inserts the table and emails it...

Am I dreaming?

Variations of the SendObject methods will allow me to do this?

Jenny
 
Like Jane said, excel cells might truncate some of your data, so if you have long fields, you may have try somthing else. I would recommend the text export. Importing with access is very very EZ!

In reference to wanting to create a db within a db. I'm sure you can open a new instance of access with vb, but importing the tables with code would take a little more research. It could get quite messy. Have Fun Sam Greene
anyone in need of a rock induced headache? if so
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top