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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to export data in a specific form

Status
Not open for further replies.

txteacher

Technical User
Jul 5, 2006
11
0
0
US
I am trying to access to keep track and print out detentions form my classroom. I was wondering if there was a way to format the reports so that it only show one detention at a time or use a Word template that pulls the data from my database.
 
Both of the above can be done quite easily, which do you prefer and what problem are you having with it?
 
I am trying to print out the current detention that I am entering to the database. When I try to use the report for this I get all the detentions based on the students ID. I would prefer to have the detention to be word document since I am also wanting it to be emailed.
 
You can use either Word or a report to email. Have you got a unique way of identifying a detention, date and time for example?

A few notes on Word
Opening a Word Document and filling it with data from an Access Form
faq702-2379
Populate a Word Doc without Merging?
faq703-760

You will find a number of post if you use advanced search in these fora with keywords 'bookmark' and 'word'. To me, Word is not a pleasant way to do this.

A few notes on reports
[tt]DoCmd.OpenReport "rptDetentions", acViewPreview,,"StudentID=" & Me.StudentID & " And DetentionDate =#" & Format(Me.DetentionDate,"yyyy/mm/dd") & "#"[/tt]

Alternatively, base your report on a query with criteria similar to the above, that is, set the criteria line for StudentID to:
[tt]=Forms!frmDetentions!StudentID[/tt]
And detention date to, say:
[tt]=Format(Me.DetentionDate,"yyyy/mm/dd")[/tt]

Use square brackets if there are spaces in the names of your fields or if you have named fields for keywords (not a good idea) such as 'date'.

With a query set up, you will can use SendObject to create your email:
[tt]DoCmd.SendObject acSendReport, "rptDetention", acFormatRTF, Me.EmailAddress, , , "Detention", "Detention attached", True[/tt]

You can also use SendObject to build an email using controls on your form.

Otherwise
Outlook is also an option.

I hope I have all that right :)
 
I see what you are talking about with trying to use Word for this process. Based on what I understand you are saying that it would be easier to create the report and make it look like the way my Word document does and then use the code to fill in for the specific detention. Correct?

In your opinion pulling the data from the table is a better way than pulling from the form?

Thanks for the help
 
It all depends but I think with a letter / form that rarely changes, it may be easier to use a report. If you need to add comments or allow users to change the template, you may need to work with Word. I find that there can be occasional annoying problems when using Word with Access, but I have not used bookmarks much: the technique may be less temperamental than merges.

As for getting data from a form or from a record to email, for the most part, it is quicker and easier to use a record and SendObject than to code to take data from a form, however, the report is sent as an attachment, which may not suit. One of the advantages of using records is that a saved record should already have passed all validation checks, whereas this may not be the case with data on a form.

I have not seen your data, so I cannot be sure, but I think I would use either SendObject or Outlook to build an email message, either from the form or a record, but that is what I am comfortable with, you will wish to look at each method and decide which suits. I dare say other members of the forum would give you good reasons for using one of the other options, or, perhaps, some option I have not thought of.
 
Thanks for the help. I am trying to get the form to work. Next is trying to tackle the email. I know it works with outlook but I have to figure out how hard it is to work with Groupwise.
 
You are welcome.

SendObject should invoke your default email client, if it does not work, this may help:
Modifying SendObject to work with Groupwise basGWdemo
thread705-1158575

If you do an advanced search in the Access fora* with Groupwise as your keyword, hundreds of posts will be returned (much fewer if you choose the subject lines option), for example:
How do you send an e-mail to Groupwise from access
thread702-919337

============================
* Microsoft: Access Forms Forum: forum702
Microsoft: Access Modules (VBA Coding) Forum: forum705
Microsoft: Access Queries and JET SQL Forum: forum701
Microsoft: Access Reports Forum: forum703
Microsoft: Access Tables and Relationships Forum: forum700
Microsoft: Access Other topics Forum: forum181
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top