Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / April 2005

Tip: Looking for answers? Try searching our database.

Brand new user making reports

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kelly - 19 Apr 2005 17:01 GMT
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.
Rick B - 19 Apr 2005 18:12 GMT
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.

> 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
[quoted text clipped - 21 lines]
> everything switched by the end of June to start our new fiscal year with
> Access.  I haven't even started that math part yet.
Kelly - 20 Apr 2005 00:37 GMT
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.  

> 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
[quoted text clipped - 69 lines]
> > everything switched by the end of June to start our new fiscal year with
> > Access.  I haven't even started that math part yet.
Rick B - 20 Apr 2005 14:37 GMT
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

> 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
[quoted text clipped - 101 lines]
> > > everything switched by the end of June to start our new fiscal year with
> > > Access.  I haven't even started that math part yet.
John Vinson - 19 Apr 2005 21:41 GMT
>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
[quoted text clipped - 4 lines]
>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]    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.