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 / Forms Programming / November 2005

Tip: Looking for answers? Try searching our database.

Browse, Open file, assign number on file, and print

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ricky S. - 28 Nov 2005 16:46 GMT
I have one letter on the shared drive that need to be printed several times
with different sequence numbers each time the letter is printed.  I need to
be able to

1.    browse and OPEN the letter. (PROBLEM:the browse window opens, but I can’t
bring up the actual letter)
2.    print a number (that I have generated in Access) in the bottom left corner
of the letter. Don't know if a bookmark is better or just a print location
will do.
3.    and then print the letter.

I need to repeat this operation several times.  

-  Once the first letter is printed, I don’t need to browse for the letter
again.
-   I want to keep the letter open and just print the next number sequence
replaced on the letter
-    and then print the letter.  

The only thing that is changing is the printed sequence number generated from
Access. This is being used to keep track of the letters sent.

Please help me with this problem.  Below is my code.

Private Sub PrintSrv_Click()
'save demographics to table
   DoCmd.Save
'browse to find letter

Dim strFilter As String
  Dim lngFlags As Long
   Dim strFileName As String
   Dim strInputFileName As String
   
   strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
   
   Debug.Print Hex(lngFlags)
   
   strInputFileName = ahtCommonFileOpenSave(InitialDir:="C:\", _
              Filter:=strFilter, OpenFile:=True, _
              DialogTitle:="Please select an input file...", _
              Flags:=ahtOFN_HIDEREADONLY)
 

'Open a database -
'don't know if I should set the database, since the database may reside
almost anywhere
Set myDataBase = OpenDatabase("C:\Documents\Letters2005.mdb")

'Access the first record from a particular table

Set myActiveRecord = myDataBase.OpenRecordset("Table_1", dbOpenForwardOnly)

'Loop through all the records in the table until the end-of-file marker is
reached

Do While Not myActiveRecord.EOF

   'If field #1 contains a non-zero value,
   'insert the value of field #2 into the document
   'after the current cursor or selection location
'This requires the user to place the cursor somewhere.  Can there be a
routine to place it at the bottom of the
'letter without cursor placement?
   If myActiveRecord.Fields("Field_1") <> 0 Then
       Selection.InsertAfter myActiveRecord.Fields("Field_2")
   End If

    'access the next record
   myActiveRecord.MoveNext

SrvNo = Field_1
RefNo = Field_2
Loop
'saves ref # and count to table
   DoCmd.Save

'prints letter with ref # on it
Me!RefNo = NZ(DMax("[Ltrid]", "[qryHome]", "[DateSeq] >= #" & DateSerial(Year
(Date()), Month(Date()), 1)) + 1

'leave word doc open to print next ref# on already open document

'If no more printing
'Then close the database
'myActiveRecord.Close
'myDataBase.Close

End Sub
Ari - 28 Nov 2005 21:35 GMT
A better way would to be to do this in word. Word can access Access and
select fields from a table and generate multiple copies of a document
based on each record.
 
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.