Brand new user making reports

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

Guest

I am brand new to Access. I just took over a job that the previous person
was using Panorama converted to be able to use on Windows. (It's a Mac
program, I don't know how they got it on windows.) Since I don't know how to
use Panorama, I decided I would rather learn Access and convert all the files
than continue working in the stone age.

I have taught myself the tables and have even figured out how to export
Panorama into a text file with commas and import them into Access. I have
figured out basic queries and have imported them into Word to make mailings.
I have a very long way to go but am starting with little stuff first.

Here is what I am trying to do today. I have a table of contacts that we
send a newsletter out to. I have made a report to look like an envelope so
that I can print evelopes straight from access instead of going into Word.
(A Panorama thing.) What I would like to do is be able to just print one
envelope if needed. For example, I have to mail something to just Mr. Smith
but not the whole group. It seems rather burdensome to make a query for just
one name. Can I not find the name while in the report and just print that
one page?

Any suggestions? Thanks.

I am sure I will be posting a lot the next few months. My goal is to have
everything switched by the end of June to start our new fiscal year with
Access. I haven't even started that math part yet.
 
What you would want to do is adda button to your form. Pull up the record
you want on the form (Mr. Smith for example) and then click the button. I
would clal the button something like "print envelope" or "single envelope".
If you add the button to your form using the wizard, you can select to have
it print your envelope report. Then, you can go back and modify the code
that the wizard created so that it will only print the current record.


In the button's code, you would need to put something similar to the
following...


Private Sub cmdPrint_Click()

Dim strWhere As String

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

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.

Post back if you need more help.
 
Here is what I am trying to do today. I have a table of contacts that we
send a newsletter out to. I have made a report to look like an envelope so
that I can print evelopes straight from access instead of going into Word.
(A Panorama thing.) What I would like to do is be able to just print one
envelope if needed. For example, I have to mail something to just Mr. Smith
but not the whole group. It seems rather burdensome to make a query for just
one name. Can I not find the name while in the report and just print that
one page?

The trick (which you will use over and over again!) is to use one
query - but make it a *parameter* query, that uses input from the Form
to select which record. Rather than "Smith" as a parameter, you would
put a criterion on the unique contact ID (which should NOT be a name;
you might have two people who both happen to be named Bill Smith) such
as

=[Forms]![YourFormName]![IDControlName]

using the name of your form and the name of a textbox or other control
on the form which contains the unique ID.

Base your Report on this query and have the command button on your
form simply open the report. It will then print only the currently
selected name.

John W. Vinson[MVP]
 
I am so new that this went over my head, at first. But after playing around
with it, I got the first part done. I have a button, but, like you said, it
prints all of the envelopes, not just the one that I want. So, I am looking
at the code that the wizard attatched to the button and I can't figure out
what you mean by modify the code. Am I supposed to copy and paste everything
that you said earlier or am I just modifying some of the code lines. If I am
copying and pasting, does it go above or below what is already there? Am I
supposed to make any changes to your code?

As an after thought, I decided to paste what I have so far.


Option Compare Database

Private Sub print_envelope_Click()
On Error GoTo Err_print_envelope_Click

Dim stDocName As String

stDocName = "Envelope"
DoCmd.OpenReport stDocName, acNormal

Exit_print_envelope_Click:
Exit Sub

Err_print_envelope_Click:
MsgBox Err.Description
Resume Exit_print_envelope_Click

End Sub



Thanks for taking the time to help someone that knows absolutely nothing.



Rick B said:
What you would want to do is adda button to your form. Pull up the record
you want on the form (Mr. Smith for example) and then click the button. I
would clal the button something like "print envelope" or "single envelope".
If you add the button to your form using the wizard, you can select to have
it print your envelope report. Then, you can go back and modify the code
that the wizard created so that it will only print the current record.


In the button's code, you would need to put something similar to the
following...


Private Sub cmdPrint_Click()

Dim strWhere As String

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

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.

Post back if you need more help.


Kelly said:
I am brand new to Access. I just took over a job that the previous person
was using Panorama converted to be able to use on Windows. (It's a Mac
program, I don't know how they got it on windows.) Since I don't know how to
use Panorama, I decided I would rather learn Access and convert all the files
than continue working in the stone age.

I have taught myself the tables and have even figured out how to export
Panorama into a text file with commas and import them into Access. I have
figured out basic queries and have imported them into Word to make mailings.
I have a very long way to go but am starting with little stuff first.

Here is what I am trying to do today. I have a table of contacts that we
send a newsletter out to. I have made a report to look like an envelope so
that I can print evelopes straight from access instead of going into Word.
(A Panorama thing.) What I would like to do is be able to just print one
envelope if needed. For example, I have to mail something to just Mr. Smith
but not the whole group. It seems rather burdensome to make a query for just
one name. Can I not find the name while in the report and just print that
one page?

Any suggestions? Thanks.

I am sure I will be posting a lot the next few months. My goal is to have
everything switched by the end of June to start our new fiscal year with
Access. I haven't even started that math part yet.
 
You would need to change your code as follows. You will need to replace the
[ID] with the name of your field that identifies the person to print. The
first [ID] is the name of the field on the report that contains the key
value. The second part Me.[ID] represents the field on the form you have
open.

Private Sub print_envelope_Click()
Dim strWhere As String
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
strWhere = "[ID] = " & Me.[ID]
DoCmd.OpenReport "Envelope", acViewPreview, , strWhere
End If
End Sub






Kelly said:
I am so new that this went over my head, at first. But after playing around
with it, I got the first part done. I have a button, but, like you said, it
prints all of the envelopes, not just the one that I want. So, I am looking
at the code that the wizard attatched to the button and I can't figure out
what you mean by modify the code. Am I supposed to copy and paste everything
that you said earlier or am I just modifying some of the code lines. If I am
copying and pasting, does it go above or below what is already there? Am I
supposed to make any changes to your code?

As an after thought, I decided to paste what I have so far.


Option Compare Database

Private Sub print_envelope_Click()
On Error GoTo Err_print_envelope_Click

Dim stDocName As String

stDocName = "Envelope"
DoCmd.OpenReport stDocName, acNormal

Exit_print_envelope_Click:
Exit Sub

Err_print_envelope_Click:
MsgBox Err.Description
Resume Exit_print_envelope_Click

End Sub



Thanks for taking the time to help someone that knows absolutely nothing.



Rick B said:
What you would want to do is adda button to your form. Pull up the record
you want on the form (Mr. Smith for example) and then click the button. I
would clal the button something like "print envelope" or "single envelope".
If you add the button to your form using the wizard, you can select to have
it print your envelope report. Then, you can go back and modify the code
that the wizard created so that it will only print the current record.


In the button's code, you would need to put something similar to the
following...


Private Sub cmdPrint_Click()

Dim strWhere As String

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

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.

Post back if you need more help.


Kelly said:
I am brand new to Access. I just took over a job that the previous person
was using Panorama converted to be able to use on Windows. (It's a Mac
program, I don't know how they got it on windows.) Since I don't know
how
to
use Panorama, I decided I would rather learn Access and convert all
the
files
than continue working in the stone age.

I have taught myself the tables and have even figured out how to export
Panorama into a text file with commas and import them into Access. I have
figured out basic queries and have imported them into Word to make mailings.
I have a very long way to go but am starting with little stuff first.

Here is what I am trying to do today. I have a table of contacts that we
send a newsletter out to. I have made a report to look like an
envelope
so
that I can print evelopes straight from access instead of going into Word.
(A Panorama thing.) What I would like to do is be able to just print one
envelope if needed. For example, I have to mail something to just Mr. Smith
but not the whole group. It seems rather burdensome to make a query
for
just
one name. Can I not find the name while in the report and just print that
one page?

Any suggestions? Thanks.

I am sure I will be posting a lot the next few months. My goal is to have
everything switched by the end of June to start our new fiscal year with
Access. I haven't even started that math part yet.
 
Back
Top