Print 2 Copies

Oct 15, 2007

I have a form in Access with a command button that prints a receipt (which is actually created as a report). Anyway, I want 2 copies of this receipt to print when the print receipt button is clicked. Please take a look at my code and tell me what I would need to be able to accomplish this. Thanks.

rivate Sub PrintRec_Click()
On Error GoTo Err_PrintRec_Click

Dim rstTrans As New ADODB.Recordset
Dim fld As ADODB.Field
Dim strField As String
Dim curCount As Currency

rstTrans.Open "dbo_tbl_Transactions", CurrentProject.Connection, adOpenKeyset, adLockOptimistic

If IsNull(Me.TempTransNumID.value) Then
'this is new record
rstTrans.AddNew
Else
'to stay on the record that was just inserted for editing
rstTrans.Find ("TransNumID=" + Str$(Me.TempTransNumID))
End If

rstTrans!TransDate = Me.TransDate
rstTrans!CustomerName = Me.CustomerName
rstTrans!VehType = Me.VehType
rstTrans!TktType = Me.TktType
rstTrans!Auth_By = Me.AuthBy
rstTrans!Quantity = Me.Quantity
rstTrans!SHtkt1 = Me.SHtkt1
rstTrans!SHtkt2 = Me.SHtkt2
rstTrans!HRtkt1 = Me.HRtkt1
rstTrans!HRtkt2 = Me.HRtkt2
rstTrans!TransPayAmt = Me.TransPayAmt
rstTrans!PaymentType = Me.txtPaymentType
rstTrans!PaymentMethod = Me.cboPaymentMethod
rstTrans!CheckNum = Me.CheckNum
rstTrans!TransReceiptMemo = Me.TransReceiptMemo
rstTrans!TransEntryTime = Now()
rstTrans!TransEntryUserID = appUser

If Me.cboPaymentMethod = "Check" And IsNull(CheckNum) Then 'Check number not entered
MsgBox "You must enter a check no.", vbCritical, "Check Number Verification"
CheckNum.SetFocus
Exit Sub
End If

rstTrans.Update
'this was a new record so update the form value of TransNumID for edit
If IsNull(rstTrans!TransNumID.value) <> True Then
Me.TempTransNumID = rstTrans!TransNumID.value
End If

whereClause = "NewQryShuttleHandiRideReceipt.TransNumID" & " = " & rstTrans!TransNumID

//////here is where I'm printing the receipt
DoCmd.OpenReport "RptShuttle HandiRide Receipt", acViewNormal, , whereClause

rstTrans.Close

Set rstTrans = Nothing
Me.cmdAddRec.Enabled = True

Exit_PrintRec_Click:
MsgBox "Record Successfully Saved! Printing Receipt."
Exit Sub

Err_PrintRec_Click:
MsgBox Err.Description
Resume Exit_PrintRec_Click

End Sub

View Replies


ADVERTISEMENT

Print 3 Copies Of Invoice With Different Remark

Jul 8, 2007

I want to print 3 copies of a report named Invoice with different remark i.e. Customer Copy, Office Copy, Auditor Copy. I want to print all 3 copies with a single print command.

Can any one help me.
Sample database is in attachmant.

View 7 Replies View Related

Print Multiple Copies Of A Report Using Macro

Jan 7, 2015

In Access 2007 is it possible to alter a macro so I can print 2 copies of a report. I have created a simple macro which opens up a report based on a value in a data entry form. I want to automatically print 2 copies of the report. Is this possible....

View 1 Replies View Related

VBA Print 5 Copies Of Report Via Button On The Form

Nov 1, 2011

I am trying to print 5 copies of the report via the button on the form.

I'm sure I have the code correct, however I only prints 1 copy instead of 5.

View 1 Replies View Related

Reports :: Workorder - Print Three Copies With Each Copy Having Different Text In Footer

Jan 23, 2014

I have an old access database (written with 2003 but running under 2010) that creates workorders and I need to change a couple of the reports to print three copies with each copy having different text in the footer. I'm converting the reports from a old DOT Metrix special form printer to a laser printer. I have already modified the reports as far as the titleing and cosmetics are concerned and they print and look great on the laser printer. I have also added a TxT box that I want to contain the information on the report.

The reports are generated in a couple of different ways off different screens in the system off buttons, but I figured if I can get one of them to work I can replicate it to the others.

I have gone through the reports forum and have found a couple of solutions but can't get them to work. This is what I have found:

On the on button to print a range of workorders (it drives a query that asks for a starting workorder number and a ending workorder number) click from the from the switchboard:

DoCmd.OpenReport "rptBulkWorkOrdersbyWorkOrderNumberRange", , , , , "1"
DoCmd.OpenReport "rptBulkWorkOrdersbyWorkOrderNumberRange", , , , , "2"
DoCmd.OpenReport "rptBulkWorkOrdersbyWorkOrderNumberRange", , , , , "3"

Then I have this code but I'm not sure where it goes. On the report in the "on open" expression? not sure..

Select Case Me.OpenArgs
Case "1"
txtBox62 = "Shop Copy"
txtFld1 = [qryField1]

[Code] .....

View 14 Replies View Related

Saving Historical Copies Of DB

Sep 14, 2006

Hiya,

I realise this could well go against almost every DB rule in the book, but figured I would ask it anyway!

I have a database, which pulls all it's data from other databases - some in SQL, some in Oracle, and some from other Access DBs.

It then combines it all, performs dozens of queries on it, and allows me to produce necessary reports on it - all fine.

I have been asked to make it save historical copies of all the data it uses. The reason for this is the Financial Services Authority, who insist that the checks we are doing on this data is all stored, so that if an auditor arrives tomorrow, and asks me to prove the data from 3 months ago was processed correctly, I have to be able to come up with that 3 month old data.

I thought the easiest thing to do would be to use a series of make-table queries to move all the tables data to an external database, which can then be archived.

Does anyone have a way of allowing me to save the entire database, as at NOW - to another database?
I would need to make all the tables LOCAL, rather than linked?

Thanks! (and sorry for the unnecessarily long post!)

View 3 Replies View Related

Multiple Copies Of The Form

Jul 17, 2006

Hi,

I finished a db for a client to help her keep track of the classes she teaches, her students and other related info. The db has several tables and one main form with subforms. I read that it was a good rule of thumb to design the fewest posible forms to make the navigation centrilized and so I did. (I also spent some time on making it look less Access like, more of a stand alone app and wish to preserve it)
Up to this point the client was using Outlook to store all the contact info plus anything else she could jam into various "notes" fields. Now she wishes to have some simillar futures in the db to the ones outlook offered, one of them:
being able to open multiple contacts (records) in new windows. So basically she wants to open many instances of the main form so she can jump between the records without closing the previous one. My question is: what is the nicest (cleanest from the point of db design) way of giving her such functionality? I thought about giving her an option to open the new record (student) in a tab, but I'm not sure how to acomplish that. Another way would be to copy the main form several times and open those as she clicks on "open in new window", but I don't think it's a good solution, becsue: e.g. How many copies do I create? I'd have to go over all the vba in each copy and adjust it so it works properly with the copy, plus all the vba in each subform... :eek:
Any thoughts would be greatly appreciated on how to tackle this. Also what are the consequences of having several instances of the same form open (editing same record by mistake, etc..)

Thank you very much,
Mariusz

View 4 Replies View Related

Compact Resulting In Copies On The Network

Nov 28, 2007

I tried the search and while I found some things related to my issue, I couldn't really come to a conclusion on my issue.

I have all the databases on the network set to compact on close. This is resulting in a new copy of the compacted database with the generic "db1.mdb" file name every time the db is compacted. It also does not compact the correct one.

So, basically...it is copying the db, compacting it, but not deleting the old one and renaming the new one.

If I copy the database to my hard drive, it compacts, deletes, and renames sucessfully.

The only thing I can think of at this point is there's some issue with the server. But this is happening on multiple servers.

View 14 Replies View Related

Field Data Copies Into Column

Sep 19, 2006

I grabbed a mdb template for customers/workorders from MS. I am trying to modify the "workorder labor" form in design view to have the first field be a manually filled in date, followed by start time, then finish time.

I got the boxes to show up.

The problem is that when I enter a date all the fields in that column are filled with the same information.

I tried variations of using a mask and format. I tried it as a text box from scratch and copying an existing one.

Any suggestions would be greatly appreciated.
Nett

View 1 Replies View Related

General :: Synchronized Copies Of The Same Database

Jun 5, 2014

I have a simple database at the moment which I would like to put onto two laptops. The laptops would be used for entering information when out on a job (no network or email connection).

What I would want to do is have a database on a desktop in the office so when the laptops come back into the office they can update the office database with the information on the laptop database.

View 2 Replies View Related

Syncronising Multiple Copies Of An Access Database

Mar 15, 2007

If I want to distribute copies of a database and have one copy as the master and syncronise data; can i use briefcase or is there a better way?:o

View 1 Replies View Related

Copy And Paste Security Permissions From Copies Of A Db

Jul 11, 2007

I have to make a new copy of a db starting with a blank db and importing all the objects into the blank. (Corruptions issues).

When a blank db is made, and the objects imported into it, the security permissions do not copy over. The only way I know how to get the security permissions back is to redo them in the new copy. It's a big db. Lots of time. Ugh.

Is there any way to copy and paste the security permissions from one db to another?

Thanks

View 1 Replies View Related

[HELP] Adding Book Copies To Book_copy Table

Mar 21, 2008

Ruralguy suggested that i made a new thread - so I'm taking his advice (H)

I've got another problem, well not problem..i want to make it more user-friendly.

Database= 21238 (Look for yourself see what i mean)
(rename to .RAR if it doesn't open)

Basically, when the user adds a book, they can add it easily..
the only problem is, when ..just say i want to add a book, and I have 10 copies of this book, I have to add the book first and the go into the ADD_BOOK_COPY form and then select the book which i want to add more copies of and click add - i repeat this for the total amount of copies that i have.
So if i had 10 copies of 1 book, i add, and then go into a seperate form and then click this button 9 more extra times.
Which, can cause headahces!


So basically, i'm thinking of implementing a new way to do this,
i was thinking about..
When i got to add a book, there's a List/Combo box with 1-20 into
So i can add the book, and then select how many copies, click 'add' and this will add 20 copies of that bookm firstly by adding it to the 'book' table and then adding 20 copies to the book_copy table..


Is there anyone who would like to help with this? :' )

Cheers btw! :)

View 7 Replies View Related

General :: Printing Multiple Copies Of A Form?

Jun 18, 2015

I have an Access based CRM system that was built for me in 1998. Amazingly it is still pretty effective. However, I would like to make a small adjustment in the programming..

Once we've added the details for an order we press continue and the screen closes and one copy of the acknowledgement of order form. I simply want it to print three copies!

I believe this is the coding part of the command that is effected.

Rem Print Report
DoCmd.OpenReport "Order Acknowledgement"
Rem Close Form
DoCmd.Close acForm, "Booking Entry"

View 2 Replies View Related

Reports :: Printing Multiple Copies Of Each Group

Sep 24, 2013

Our access database keep track of children attending an after-school music programme.

Each week we print registers and give them to the class teachers for them to mark who is coming. The registers are produced as a report, grouped by School then by Class.

We run 3 times a week so each week I need to print off 3 copies of the registers for each class.

Is there a way to print multiple copies of each group in a report? This would save me quite a bit of time each week.

I'm using Access 2013...

View 5 Replies View Related

Forms :: Command Button Prints Two Separate Copies?

Mar 20, 2013

I am working with an already intact database along with a form. One of the buttions in the form, when pressed, prints two copies of a P.O. One copy says original on the bottom and the other says PX Copy and my boss wants the PX Copy to stop printing. How do I get it to stop?

View 3 Replies View Related

General :: Front End Copies Itself To Desktop After Closing Database

Apr 3, 2015

I have a split db that has been in use for a few years by about 12 people. The front end is compiled into an accde file.

Ocasionally a user (randomly) might get an error message "Microsoft has detected that this database is in an inconsistent state...." when closing the db and when that happens, a copy of the front end is automatically placed on their desktop.

This front end is always deleted and the original front end continues to work just fine afterwards.

Why are my users getting this error message? Why is the front end automatically copied onto their desktops?

View 6 Replies View Related

I Want To Print A Report And Programmatically Set The Printer Name And 'Print To File

Jul 16, 2007

How can I print a report and at the same time programatically set the printer name and 'Print to File' option and set the path of this option?

View 1 Replies View Related

How To Hide Or Disable Print Or Quick Print Options

Dec 4, 2014

I have a form which my company wanted that each single record should be printed from form. I made a print record button and put code to print single page or record. However as a natural habit people go to file > print to print which leads printing all records so 1000's records start printing. Is there any way i can hide print button. File >Print button.

View 1 Replies View Related

Queries :: Cartesian Table - Create Multiple Copies Of A Record To Use For Printing Labels

Aug 5, 2013

I am using a cartesian query to create multiple copies of a record to use for printing labels.

Here's my query that produces the cartesian result:

SELECT tblCount.CountID, tblDeliveryOrders.DeliveryOrderNum, CurrentCY.Deliveryorderlineitemnum, CurrentCY.Quant, CurrentCY.UOM1, tblContainerSizeCodes.SizeCode, tblContainerTypeCodes.TypeCode, CurrentCY.WasteDescription, tblEtidDodaac.EtidDodaac, CurrentCY.ETIDDocNum, CurrentCY.Pounds, tblEPAWasteCodes.[EPAWasteCodes(1B)]

[Code] ....

This works just fine in creating the desired result - EXCEPT I don't get all the records.

When I remove the 'cartesian table', and right join everything, then I get the correct results. If I keep everything as-is and reintroduce the cartesian table, then I get an error about there being an ambiguous outer join.

View 3 Replies View Related

Reports :: Query Based On Linked Tables - Report Produces Multiple Copies Of The Same Record

Jul 22, 2013

My report produces multiple copies of the same record. I know why, but don't know how to fix it.

EmployeeTable.

With a one to many relationship with TrainingTable (via employee PK as FK in trainingtable).

Training table has a one to many relationship with a table called Range.

Report is based on a query that picks up the Employee/Training/Range (range just describes the training unit).

However, If I have more than one range expressed organized a training unit, the report spits out several copies of the Employee record to display all the ranges.

View 2 Replies View Related

Reports :: Unbound Report - Print Preview OK But None Of Fields Print When Report Directly Send To Printer

May 25, 2013

I have an unbound form with an associated report. When the user hits the 'print' button on the form/screen, the report is launched in the background. In the On Load event of the report I populate the report fields from the forms field as so:

Code:
Me.txtAddrMainLine2 = "NAME " & UCase([Forms]![frm_OrderRx].[txtPatientName])

This works like a charm as long as I call the report in Print Preview mode (i.e. with acViewPreview). But if I send the report directly to the printer, none of the fields print.

I've read about using other report events to populate the fields (e.g., On Format and On Print) and also something about using TempVars to pass the data. But I haven't read anything that's clear and definitive about the full answer.

View 3 Replies View Related

Reports :: Publishing Multiple Copies Of Selected Reports

Nov 18, 2013

I am trying to add to a db I inherited. One of the end reports that is produced is a cost breakdown for each end user.As things stand, the data collates into individual reports which are then grouped into one file and saved via PDF. What I am trying to work out is whether or not I can selectively pick some of those reports to have more than one copy.

I see a form (within an existing form) that will list all of the end users for a particular scheme and, next to that, be a dropdown that will allow the db user to select how many copies of each report needs to be published. These will then collate merrily into one document to be saved to PDF.

View 8 Replies View Related

Print To PDF - Almost There....

Nov 9, 2005

The code below does not give me any error. I do get a file save dialog box and i put the file name and a message saying export is done. but in reality there is no pdf file saved under what ever directory i told the system to save...




Public Sub Print2PDF(strReportName As String, Optional strPath As String)

Dim stDocName As String, strFilter As String
Dim Distiller As ACRODISTXLib.PdfDistiller

'InputPSFile - path to existing PS file in c: emp
'OutputPDFFile - path of PDF file to be created in c: emp
'2 lines of code:
'ACRODISTXLib.PdfDistillerClass Distiller=new ACRODISTXLib.PdfDistillerClass();
'Distiller.FileToPDF(InputPSFile, OutputPDFFile,"");

Set Distiller = CreateObject("PdfDistiller.PdfDistiller.1")
Distiller.bSpoolJobs = False
Distiller.bShowWindow = False
ITransform_Transform = False

'Ask for the path if it is not provided
If Trim(strPath) = "" Then
strFilter = ahtAddFilterItem(strFilter, "Adobe PDF Files (*.pdf)", "*.pdf")
strPath = ahtCommonFileOpenSave( _
OpenFile:=False, _
Filter:=strFilter, _
flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
End If

'If Distiller.FileToPDF(pFromFile, pToFile, "") Then

'If Distiller.FileToPDF("strReportName.ps", "", "") Then
Distiller.FileToPDF "strReportName.ps", "", ""

'Distiller.FileToPDF OutputDir & "" & ps, OutputDir & "" & pdf, ""
' ITransform_Transform = True
'End If

Set Distiller = Nothing

End Sub

View 1 Replies View Related

Print To PDF

Nov 10, 2005

I used to be able to create PDFs, automatically save them to a file,
and mail them out to people. This was on Access 97 with Windows NT.
We've changed to Windows XP and Access 2003. Doesn't work anymore.
Part of the problem is that the users have no access to the registry
and can only save files on the C: drive to their My Documents folder.
I found this code on the web, but it doesn't work either. The files
continue to print out of my printer instead of making a PDF. I put the
entire code at the bottom, but here is the part I'm calling:

Public Sub SaveReportAsPDF(strReportName As String, Optional strPath As String)

Dim strOldDefault As String
Dim strFilter As String

'Ask for the path if it is not provided
If Trim(strPath) = "" Then
strFilter = ahtAddFilterItem(strFilter, "Adobe PDF Files (*.pdf)", "*.pdf")
strPath = ahtCommonFileOpenSave( _
OpenFile:=False, _
Filter:=strFilter, _
flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
End If

'remember old printer
strOldDefault = QueryKey("SoftwareMicrosoftWindowsCurrentVersionWindows", "Device")

'changes to pdf writer
SetKeyValue "SoftwareMicrosoftWindowsCurrentVersionWindows", "Device", "Adobe PDF", REG_SZ

SetKeyValue "SoftwareAdobeAcrobat Distiller", "PDFFilename", strPath, REG_SZ

SetKeyValue "SoftwareAdobeAcrobat Distiller", "bExecViewer", 0, REG_SZ

'Distiller.FileToPDF strReportName
DoCmd.OpenReport strReportName

'put the old printer back to default
SetKeyValue "SoftwareMicrosoftWindowsCurrentVersionWindows", "Device", strOldDefault, REG_SZ

End Sub



The entire code:

' ################################################## #######
Option Compare Database
Option Explicit

Public Const REG_SZ As Long = 1
Public Const REG_DWORD As Long = 4

Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const HKEY_USERS = &H80000003

Public Const ERROR_NONE = 0
Public Const ERROR_BADDB = 1
Public Const ERROR_BADKEY = 2
Public Const ERROR_CANTOPEN = 3
Public Const ERROR_CANTREAD = 4
Public Const ERROR_CANTWRITE = 5
Public Const ERROR_OUTOFMEMORY = 6
Public Const ERROR_ARENA_TRASHED = 7
Public Const ERROR_ACCESS_DENIED = 8
Public Const ERROR_INVALID_PARAMETERS = 87
Public Const ERROR_NO_MORE_ITEMS = 259

Public Const KEY_QUERY_VALUE = &H1
Public Const KEY_SET_VALUE = &H2
Public Const KEY_ALL_ACCESS = &H3F

Public Const REG_OPTION_NON_VOLATILE = 0

Declare Function RegCloseKey Lib "advapi32.dll" _
(ByVal hKey As Long) As Long
Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias _
"RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, _
ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions _
As Long, ByVal samDesired As Long, ByVal lpSecurityAttributes _
As Long, phkResult As Long, lpdwDisposition As Long) As Long
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias _
"RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, _
ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As _
Long) As Long
Declare Function RegQueryValueExString Lib "advapi32.dll" Alias _
"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As _
String, ByVal lpReserved As Long, lpType As Long, ByVal lpData _
As String, lpcbData As Long) As Long
Declare Function RegQueryValueExLong Lib "advapi32.dll" Alias _
"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As _
String, ByVal lpReserved As Long, lpType As Long, lpData As _
Long, lpcbData As Long) As Long
Declare Function RegQueryValueExNULL Lib "advapi32.dll" Alias _
"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As _
String, ByVal lpReserved As Long, lpType As Long, ByVal lpData _
As Long, lpcbData As Long) As Long
Declare Function RegSetValueExString Lib "advapi32.dll" Alias _
"RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, _
ByVal Reserved As Long, ByVal dwType As Long, ByVal lpValue As _
String, ByVal cbData As Long) As Long
Declare Function RegSetValueExLong Lib "advapi32.dll" Alias _
"RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, _
ByVal Reserved As Long, ByVal dwType As Long, lpValue As Long, _
ByVal cbData As Long) As Long
Public Function SetValueEx(ByVal hKey As Long, sValueName As String, _
lType As Long, vValue As Variant) As Long
Dim lValue As Long
Dim sValue As String
Select Case lType
Case REG_SZ
sValue = vValue & Chr$(0)
SetValueEx = RegSetValueExString(hKey, sValueName, 0&, _
lType, sValue, Len(sValue))
Case REG_DWORD
lValue = vValue
SetValueEx = RegSetValueExLong(hKey, sValueName, 0&, _
lType, lValue, 4)
End Select
End Function
Function QueryValueEx(ByVal lhKey As Long, ByVal szValueName As _
String, vValue As Variant) As Long
Dim cch As Long
Dim lrc As Long
Dim lType As Long
Dim lValue As Long
Dim sValue As String

On Error GoTo QueryValueExError

' Determine the size and type of data to be read
lrc = RegQueryValueExNULL(lhKey, szValueName, 0&, lType, 0&, cch)
If lrc <> ERROR_NONE Then Error 5

Select Case lType
' For strings
Case REG_SZ:
sValue = String(cch, 0)

lrc = RegQueryValueExString(lhKey, szValueName, 0&, lType, _
sValue, cch)
If lrc = ERROR_NONE Then
vValue = Left$(sValue, cch - 1)
Else
vValue = Empty
End If
' For DWORDS
Case REG_DWORD:
lrc = RegQueryValueExLong(lhKey, szValueName, 0&, lType, _
lValue, cch)
If lrc = ERROR_NONE Then vValue = lValue
Case Else
'all other data types not supported
lrc = -1
End Select

QueryValueExExit:
QueryValueEx = lrc
Exit Function

QueryValueExError:
Resume QueryValueExExit
End Function
Public Function CreateNewKey(sNewKeyName As String, lPredefinedKey As Long)

Dim hNewKey As Long ' Handle to the new key
Dim lRetVal As Long ' Result of the RegCreateKeyEx function

lRetVal = RegCreateKeyEx(lPredefinedKey, sNewKeyName, 0&, vbNullString, REG_OPTION_NON_VOLATILE, _
KEY_ALL_ACCESS, 0&, hNewKey, lRetVal)

RegCloseKey (hNewKey)

End Function
Public Function SetKeyValue(sKeyName As String, sValueName As String, vValueSetting As Variant, lValueType As Long)

Dim lRetVal As Long ' Result of the SetValueEx function
Dim hKey As Long ' Handle of open key

' Open the specified key
lRetVal = RegOpenKeyEx(HKEY_CURRENT_USER, sKeyName, 0, KEY_SET_VALUE, hKey)

lRetVal = SetValueEx(hKey, sValueName, lValueType, vValueSetting)

RegCloseKey (hKey)

End Function
Public Function QueryKey(sKeyName As String, sValueName As String)

Dim lRetVal As Long ' Result of the API functions
Dim hKey As Long ' Handle of opened key
Dim vValue As Variant ' Setting of queried value

lRetVal = RegOpenKeyEx(HKEY_CURRENT_USER, sKeyName, 0, KEY_QUERY_VALUE, hKey)

lRetVal = QueryValueEx(hKey, sValueName, vValue)

QueryKey = vValue

RegCloseKey (hKey)

End Function
Public Sub SaveReportAsPDF(strReportName As String, Optional strPath As String)

Dim strOldDefault As String
Dim strFilter As String

'Ask for the path if it is not provided
If Trim(strPath) = "" Then
strFilter = ahtAddFilterItem(strFilter, "Adobe PDF Files (*.pdf)", "*.pdf")
strPath = ahtCommonFileOpenSave( _
OpenFile:=False, _
Filter:=strFilter, _
flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
End If

'remember old printer
strOldDefault = QueryKey("SoftwareMicrosoftWindowsCurrentVersionWindows", "Device")

'changes to pdf writer
SetKeyValue "SoftwareMicrosoftWindowsCurrentVersionWindows", "Device", "Adobe PDF", REG_SZ

SetKeyValue "SoftwareAdobeAcrobat Distiller", "PDFFilename", strPath, REG_SZ

SetKeyValue "SoftwareAdobeAcrobat Distiller", "bExecViewer", 0, REG_SZ

'Distiller.FileToPDF strReportName
DoCmd.OpenReport strReportName

'put the old printer back to default
SetKeyValue "SoftwareMicrosoftWindowsCurrentVersionWindows", "Device", strOldDefault, REG_SZ

End Sub

View 1 Replies View Related

Print Subdatasheet

Nov 24, 2005

Hi!

I would like to print a table including subdatasheets in Access. However, in Access 2002 it collapses them, and closes the table when I click on Print Preview. (In Access 2000 it works.)
Any ideas?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved