Emailing Access Database Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to know if it is possible to email an Access database record. I
have a database for trouble tickets and my boss has asked if it is possible
to email the trouble ticket to someone. I have seen some questions where an
answer was posted that a record can only exist as an image (like a word
document of the table), but I am unsure how users of this database can email
one of the tickets to another. Any help or guidance with this would be most
appreciated.

Thanks,
Roxanne
 
I would email a REPORT, not a FORM. The report can be built to include the
fields from the record that you wish to share with the other user.
 
My boss would like to be able to email the entire ticket (record) to others.
So my next question is - how do you build a report that would show an entire
ticket? I'm assuming, you would have to build a different report for each
ticket you wanted to email? I'm not sure my boss wants everyone to have to
go through creating a report just to email a particular ticket to someone.
Is there a way to create a canned report that would allow a user to pick a
different record each time the report is launched and how do you email a
report?

Thanks so much for your help - it is greatly appreciated.
Roxanne
 
Just build a report to include all the data you want. Make it look like
your form (or very similar). You can even open your form and do a "save as"
and save it as a report, then clean it up.

Add a button to your form and call it "email ticket" or similar.

You will have to build code using the Docmd.SendObject to send the report.

You can use a filter in your report to make it only show the record where
the ticket number is equal to the one on your form.

good luck!
 
Ok I have a report with the data I want included in the report. I added a
button to my form, but now I'm stuck on how to write a filter. I've been
searching everywhere on the basic of how to write a filter to send the
current trouble ticket number and haven't been able to find out the exact
steps to writing a filter. Also, I have no idea how to write VB code for the
Docmd.SendObject you mentioned. I'm totally lost on where you write the code
to email the ticket. Basically, I'm totally lost on these two points. I
know if I can see an example of what I have to do I can put the code in, and
probably get this to work, but knowing how to do it off the top of my head I
don't. Do you know any place that will show basic steps in writing a filter
and the VB code?

Thanks so much for your patience and help - I do appreciate it.
Roxanne
 
Ok, for the code, just use the wizard. It allows you the option to "send a
report through email". It will create the basic code tied to the button.
You can go back into the vba code and modify the line to include an email
address, subject, etc.

I don't think you can apply a filter in vba code when sending a report via
email. Maybe someone else will jump in. What I would do is simply apply
the filter to my query upon which the report is based. So...

Your new report (we'll call it "Ticket-Email") should be built on a saved
query (we'll call it "qryTicketEmail"). This query should have a column for
TicketNumber or some other unique field. You should tell the query to only
pull for one ticket (the one currently on your open form). To do so, change
your criteria to something like the following...

=[Forms]![Your FormNameHere]![YourTicketFieldFromTheFormHere]

What this will do is...

When you run the Ticket-Email report the query tht pulls in the info will go
out and look at your form (which must be opened and must have a valid ticket
displayed) and will produce the report ONLY for the ticket being displayed.

To email the report, your button will open the report and add it to an
email. You can fill in the various options and click your send button.

NOW for a few error checks....

The code that the button writes will do what I said above. Typically, the
wizard writes a bunch of extra stufff to do this. You could replace the
whole event with the code I provide below...

You may want to add a check to make sure the form is actually displaying a
record. Also, if the person is in the process of making changes or adding
that record, then you will have trouble. Here is the code to do that...



Private Sub cmdEmailReport_Click()

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to
print

MsgBox "Select a record to print"

Else

DoCmd.SendObject acReport, "Ticket-Email", , , , , "Subject
of email here", "Any Message Text Here"


End If

End Sub
 
Sorry Rick, you totally went way beyond what I thought I could do. I don't
know what wizard you are talking about using for the code.

I have the form, I had already created a report via the wizard, but
apparently that wasn't the way to do it. So I created a query based off of
the important fields from my form (Ticket Number) being the first column (and
it's unique). I got to Advance Filter/Sort and put the code you have below
into the Criteria cell (substituting my form and column name), but that did
absolutely nothing... how do you save that filter once you put in that
criteria - and I take it you have to select a "field" for that criteria
(which I selected Ticket Number). So that didn't work out for me.

Sorry to have wasted your time - I guess I really needed step by step
instructions and will have to find money to take some Access classes so I can
do some of this advanced stuff (which probably isn't advanced to you lol).
I'm just getting stuck every step of the way in what I thought would be
something simple to just send an email of a ticket to a co worker. I need
step by step instructions and I know this forum isn't for that.

Thanks for your patience and help.
Roxanne

Rick B said:
Ok, for the code, just use the wizard. It allows you the option to "send a
report through email". It will create the basic code tied to the button.
You can go back into the vba code and modify the line to include an email
address, subject, etc.

I don't think you can apply a filter in vba code when sending a report via
email. Maybe someone else will jump in. What I would do is simply apply
the filter to my query upon which the report is based. So...

Your new report (we'll call it "Ticket-Email") should be built on a saved
query (we'll call it "qryTicketEmail"). This query should have a column for
TicketNumber or some other unique field. You should tell the query to only
pull for one ticket (the one currently on your open form). To do so, change
your criteria to something like the following...

=[Forms]![Your FormNameHere]![YourTicketFieldFromTheFormHere]

What this will do is...

When you run the Ticket-Email report the query tht pulls in the info will go
out and look at your form (which must be opened and must have a valid ticket
displayed) and will produce the report ONLY for the ticket being displayed.

To email the report, your button will open the report and add it to an
email. You can fill in the various options and click your send button.

NOW for a few error checks....

The code that the button writes will do what I said above. Typically, the
wizard writes a bunch of extra stufff to do this. You could replace the
whole event with the code I provide below...

You may want to add a check to make sure the form is actually displaying a
record. Also, if the person is in the process of making changes or adding
that record, then you will have trouble. Here is the code to do that...



Private Sub cmdEmailReport_Click()

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to
print

MsgBox "Select a record to print"

Else

DoCmd.SendObject acReport, "Ticket-Email", , , , , "Subject
of email here", "Any Message Text Here"


End If

End Sub








--
Rick B



Roxanne said:
Ok I have a report with the data I want included in the report. I added a
button to my form, but now I'm stuck on how to write a filter. I've been
searching everywhere on the basic of how to write a filter to send the
current trouble ticket number and haven't been able to find out the exact
steps to writing a filter. Also, I have no idea how to write VB code for the
Docmd.SendObject you mentioned. I'm totally lost on where you write the code
to email the ticket. Basically, I'm totally lost on these two points. I
know if I can see an example of what I have to do I can put the code in, and
probably get this to work, but knowing how to do it off the top of my head I
don't. Do you know any place that will show basic steps in writing a filter
and the VB code?

Thanks so much for your patience and help - I do appreciate it.
Roxanne
 
Roxanne said:
Sorry Rick, you totally went way beyond what I thought I could do. I don't
know what wizard you are talking about using for the code.

I have the form, I had already created a report via the wizard, but
apparently that wasn't the way to do it. So I created a query based off of
the important fields from my form (Ticket Number) being the first column (and
it's unique). I got to Advance Filter/Sort and put the code you have below
into the Criteria cell (substituting my form and column name), but that did
absolutely nothing... how do you save that filter once you put in that
criteria - and I take it you have to select a "field" for that criteria
(which I selected Ticket Number). So that didn't work out for me.

Sorry to have wasted your time - I guess I really needed step by step
instructions and will have to find money to take some Access classes so I can
do some of this advanced stuff (which probably isn't advanced to you lol).
I'm just getting stuck every step of the way in what I thought would be
something simple to just send an email of a ticket to a co worker. I need
step by step instructions and I know this forum isn't for that.

Thanks for your patience and help.
Roxanne

Rick B said:
Ok, for the code, just use the wizard. It allows you the option to "send a
report through email". It will create the basic code tied to the button.
You can go back into the vba code and modify the line to include an email
address, subject, etc.

I don't think you can apply a filter in vba code when sending a report via
email. Maybe someone else will jump in. What I would do is simply apply
the filter to my query upon which the report is based. So...

Your new report (we'll call it "Ticket-Email") should be built on a saved
query (we'll call it "qryTicketEmail"). This query should have a column for
TicketNumber or some other unique field. You should tell the query to only
pull for one ticket (the one currently on your open form). To do so, change
your criteria to something like the following...

=[Forms]![Your FormNameHere]![YourTicketFieldFromTheFormHere]

What this will do is...

When you run the Ticket-Email report the query tht pulls in the info will go
out and look at your form (which must be opened and must have a valid ticket
displayed) and will produce the report ONLY for the ticket being displayed.

To email the report, your button will open the report and add it to an
email. You can fill in the various options and click your send button.

NOW for a few error checks....

The code that the button writes will do what I said above. Typically, the
wizard writes a bunch of extra stufff to do this. You could replace the
whole event with the code I provide below...

You may want to add a check to make sure the form is actually displaying a
record. Also, if the person is in the process of making changes or adding
that record, then you will have trouble. Here is the code to do that...



Private Sub cmdEmailReport_Click()

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to
print

MsgBox "Select a record to print"

Else

DoCmd.SendObject acReport, "Ticket-Email", , , , , "Subject
of email here", "Any Message Text Here"


End If

End Sub








--
Rick B



Roxanne said:
Ok I have a report with the data I want included in the report. I added a
button to my form, but now I'm stuck on how to write a filter. I've been
searching everywhere on the basic of how to write a filter to send the
current trouble ticket number and haven't been able to find out the exact
steps to writing a filter. Also, I have no idea how to write VB code
for
the
Docmd.SendObject you mentioned. I'm totally lost on where you write
the
code
to email the ticket. Basically, I'm totally lost on these two points. I
know if I can see an example of what I have to do I can put the code
in,
and
probably get this to work, but knowing how to do it off the top of my
head
I
don't. Do you know any place that will show basic steps in writing a filter
and the VB code?

Thanks so much for your patience and help - I do appreciate it.
Roxanne

:

Just build a report to include all the data you want. Make it look like
your form (or very similar). You can even open your form and do a
"save
as"
and save it as a report, then clean it up.

Add a button to your form and call it "email ticket" or similar.

You will have to build code using the Docmd.SendObject to send the report.

You can use a filter in your report to make it only show the record where
the ticket number is equal to the one on your form.

good luck!
--
Rick B



My boss would like to be able to email the entire ticket (record) to
others.
So my next question is - how do you build a report that would show an
entire
ticket? I'm assuming, you would have to build a different report
for
each
ticket you wanted to email? I'm not sure my boss wants everyone
to
have
to
go through creating a report just to email a particular ticket to someone.
Is there a way to create a canned report that would allow a user
to
pick a
different record each time the report is launched and how do you
email
a
report?

Thanks so much for your help - it is greatly appreciated.
Roxanne

:

I would email a REPORT, not a FORM. The report can be built to include
the
fields from the record that you wish to share with the other user.

--
Rick B



I would like to know if it is possible to email an Access database
record.
I
have a database for trouble tickets and my boss has asked if it is
possible
to email the trouble ticket to someone. I have seen some questions
where
an
answer was posted that a record can only exist as an image (like a
word
document of the table), but I am unsure how users of this
database
can
email
one of the tickets to another. Any help or guidance with this would
be
most
appreciated.

Thanks,
Roxanne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top