views:

692

answers:

2

At work we have this reporting tool. It is distributed to everyone as a MDE tool that is locked up pretty good (VBA is unviewable, cannot import any of the table, query, forms, etc). When each person fills out their applicable portion there is a button that conslidates it into a text file, and then sends it to Outlook. Then everyone emails it to one person.

So I have come up with need to use this in my own database:

Remote Employees fill out a form that creates a power point presentation for them, and this part I think I have nailed down. This helps us track metrics on these presentations, rather than the employee manually creating a the ppt, and then we coming behind and manully entering the data from the brief into a form. Makes sense right.

Here is my problem, at the office, this is solved, but for those out in the field I need a similiar tool like the one mentioned above; where they get the benefit of the autogenerated ppt, and then I can have them send me the text file through email I can add to the db.

Here are my questions because I am just getting into the beginning of this:

-The form is pretty long because there is A LOT of info going into a ppt, so I use one form with tabs for different sections, but it all becomes on record in the table, and one ppt. How do I turn all this information, this one record, into a text file, and how do I use the Send to Outlook, all with one button click??

-When the user emails em the text file, how do I import it into the database table?

-How do you lock up a MDE so that the VB is unviewable, and the object cannot be imported into another application?

any other advice, tips, "your crazy man!"s, are welcome! thanks as always!

A: 

Have you considered replication rather that a text file? The data would be stored in a replicated back-end file with Access Security, which could be returned to you. CDO should suit for emailing.

Text

Access has DoCmd.TransferText, which will allow you to both export and import a text file.

CDO

   Private Sub SendEmailCDO()
   'Requires reference to Microsoft CDO for Windows 2000
   Dim cdoConfig As Object
   Dim strSubject As String
   Dim strBody As String
   Dim strFile As String
   Dim cdoMessage As Object

       'Set up detail of the mail server
       Set cdoConfig = CreateObject("CDO.Configuration")
       With cdoConfig.Fields
           .Item(cdoSendUsingMethod) = 2 ''cdoSendUsingPort
           .Item(cdoSMTPServerPort) = 25
           .Item(cdoSMTPServer) = "smpt.themailserver.com"
           .Item(cdoSendUserName) = "[email protected]"
           .Item(cdoSendPassword) = "password"
           .Update
       End With

       ''This is the subject line for the email.
       strSubject = "Membership List"

       ''This is the message with a little HTML.
       strBody = "<P>Here is the membership list for <FONT color=#ff0000>" _
        & Format(Date, "mmmm yyyy") & "</FONT>.</P><P>Regards, LTD</P>"

       ''Location of Attachment
       strFile = "C:\Docs\MembershipList.rtf"

       ''Set up the email message
       Set cdoMessage = CreateObject("CDO.Message")
       With cdoMessage
           .Configuration = cdoConfig
           .Subject = strSubject
           .From = "[email protected]"
           .To = "[email protected]"
           .HTMLBody = strBody
           .AddAttachment strFile
           .Send
       End With

   End Sub

Further information: http://wiki.lessthandot.com/index.php/Access_and_Email

Remou
that is one possibility I suppose. sometime these sales rep are out for a while and I was thinking that the email txt consildation would alloy me to get the metrics into the database a lot sooner though. what is CDO? remember me, the rookie? ;)
Justin
I do. :) I have edited my post.
Remou
thanks once again remou!
Justin
I see absolutely no requirements in the original question that would suggest any applicability for Jet replication, which is a complicated technology with lots of pitfalls. I've been using it to create apps for clients since 1997, but it took many years to learn many painful lessons. It's a great tool, but not recommended for situations such as this. If it weren't for the good email code I'd vote this down. If it weren't for the replication recommendation, I'd vote it up.
David-W-Fenton
I evaluted CDO a few weeks ago for emailing in an environment using standalone Outlook. I concluded that without Exchange Server, you wouldn't end up with copies of your email in your SENT file. Was I wrong on that?
David-W-Fenton
Oh, I just realized you reccommended "returning" the replicated back end. This is a WRONG ADVICE. Replicas must stay in the original location where they are first editing and must be synched in place. Otherwise you create "dead replicas" which can eventually hose your entire replica set. See the Jet Replication Wiki FAQ question 5 for an explanation, http://dfenton.com/DFA/Replication/index.php?title=FAQ). Because of that bad advice, I've decided to vote this down.
David-W-Fenton
A: 

@Justin asks:

-How do you lock up a MDE so that the VB is unviewable, and the object cannot be imported into another application?

The question makes no sense, unless the person asking it has failed to grasp what an MDE is. THERE IS NO VIEWABLE CODE LEFT IN AN MDE. It has been stripped out and all that remains is the compiled p-code. For an a helpful article on VBA compilation in Access that incidentally explains the relationship between canonical code and compiled p-code, see Michael Kaplan's "The real deal on the /Decompile switch."

Keep in mind that this applies only to code-bearing objects (forms/reports/modules) and not to tables and queries.

David-W-Fenton
I am certain that my lack of understanding is the cause, because....I lack understanding. but that is why i appreciate your answer and reference for learning because i need it.i suppose this (like many other of my questions) was just poorly asked...I have noticed that with some MDBs (not MDEs) you can import objects like forms, queries, etc into your own database, and some seem to have that function locked out. How do I acomplish this? thanks for putting up with the newbies!
Justin
Read the help file on MDEs. That will answer your question.
David-W-Fenton