Print Subdatasheet
Nov 24, 2005Hi!
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?
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?
I have a table for Inventory Items which lists the Item #, Description, Vendor, Pricing, Etc. I also have a table for Inventory Control which lists the quantites in inventory, what was sold and bought, etc. I want to create a subdata sheet in the Inventory Control table, so when you expand it only the information on that item comes up, but when I create the subdatasheet it brings up all the items. How do I create the subdata sheet so only the information I want is shown and not the whole table?
View 1 Replies View RelatedDear folks,
I have a form, which in it's turn has a subform (datasheettype). Each work with different tables and are related to eachother. Unique key of motherform's table has several occurences in the subform's table.
Enfin, what I now want to do is have a textbox inside my main form displaying the total amount of values of one of the subform's columns. Please advice!
Thanks so much in advance!
I want to apply a parameter query to a subdatasheet.
I have a primary query that has a list of all the machines we service, this same query will count the number of service calls within a given date range that the user inputs.
(For the date criteria- Between [Enter Period Start Date] and [Enter Period End Date])
The resulting query datasheet is linked to a subdatasheet from another query that searches all the service calls and links it to the Machine ID.
So when I expand the subdatasheet it shows all the service calls for that machine, beyond the date range.
How can I make it so that the date range from the primary query applies to the subquery?
(without having to re-enter the date range everytime I expand the subdatasheet)
Please forgive me if this has already been explained...but I've searched and searched and haven't found anything like it...
I have a form which contains a command button to open another form which is attached to a subdatasheet in Microsoft Access 2002. When I click on the button to open the sub form, I would like for it to automatically copy the contents of a text box on the original form to a text box on the sub form.
Any help you could offer would be appreciated.
- Taylor
What I am doing, is I have various products with 5 basic fields. I then wanted to add an array of text fields to 2 of those original 5 basic fields. I attempted to do this with a subdatasheet, however, a subdatasheet is not record specific, is not directed to a specific field, and really does not do anything that I want.
Say that the basic field is ProductDescription. I want one column of fields to correlate to it, like below.
ProductDescription
Is blue
Is large
Is heavy
Is strong
Each product will have a different amount of varying descriptor fields. Once understand how to incorporate this with my project, I then will need to understand how to add the subdatasheet to a report easily. Thanks for any help,
-SethTherrien
Linked field is shown both in Master and child tables, but not in the default subdatasheets made by when a relationship is made between a Master and Child Table.
View 5 Replies View RelatedWe just upgraded to Office 2007 and are experiencing very slow access performance. This microsoft article addresses the problem:
http://support.microsoft.com/kb/275085
It won't let me change Subdatasheet Name property to [NONE].
Even if I am able to change it, will this affect my table links. I have a lot of them.
I am just the part-time Access "programmer" here and am somewhat lost trying to figure this out. Does anyone have a simple explanation and solution? I would appreciate any help so much!!
I have a form which has a subdatasheet attached to it. there could be 1000 records in the main form but only 10O records in the Subdatasheet that match the records in the main form , these are linked by a "product number" .
Is it possible for the row in the main form to be "red" where there is data in the Subdatasheet that is matched by the "product number".
In open Mainform event
Forms!Mainform.Form!SubForm!controlname.columnhidd en = false doesn't work. Ms Access can't find "subform"
On load and open events in subform doesn't work with columnhidden. (no reaction)
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 RelatedI 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 RelatedI 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.
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
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
Hello!
I would like to be able to print a specified form when a new record is added to my database.
I have an add form which can be filled in, and there is an "Add" button at the bottom of the page, when this is clicked, I want the record to be added but also a specified form to be printed named "frmKitChecklist".
As I am a VB noob I do not know the code to do this, please could someone help me!
Thanks :)
I have the following problem:The print button in access was associated with the default printer, but for some reason know there is no printer associated with it. If I click on it nothing happens. Also if i go through File->Print no screen pops up. Can anyone help me with this problem.TIA,Roda
View 3 Replies View RelatedHi,
Is there anyway to print tables when they are in design view?
I can't even copy and paste it on spread sheet!
Regards,
B
I have 3 tables of Adds in my DB...
I have 3 dif. env.s (ranging in dimensions)
I want to able to choose the adds i want to print out on selective env.s And print them out... how do i get to do it?
I need to print out my VBA code , I was wondering if there is an easier way to do it without cutting and pasting it onto Microsoft word.
View 1 Replies View RelatedHello,
What's is the exact syntax to print a subformB (within a formA) using VBA code?
The code will be on the OnClick event of a button and the button is on formA.
Thanks
I need a system which will tick all the boxes to corresponding records when I print a report?
The next time I open the report it would only show the unticked boxes which had yet to be printed.
Thanks for your help,
Richard
Is there an easy way to printout a form in disignview so the fieldnames appear in the inputboxes? I've a form with 11 tabs and on each tab at least 10 input boxes (10x11 = 110 boxes :eek: ) Writing down the names on a printout is NOT effective
Thnx
I ned to create a form that asks the user which reports they want to preview/print. I see it as a set of tick boxes with one saying all, then a print button. Im not really sure though, can someone offer some advise or maybe an example?
View 5 Replies View RelatedHi, (sorry to be cross-posting, but I didn't get any response from Modules and VBA)
I've messed something up, I think. But I'm not sure if I messed up VB or some connection in Access.
The Symptoms: I've got a print page with checkboxes that represent other form pages in my db.
The page basically prints ok, except where field information is supposed to be.
Wherever there should be field info, it prints #Name? instead. Each field can't seem to find it's info.
The funny thing is that the information displays correctly in the form onscreen.
Just not when I print.
Basically someone else wrote the the Print code and I've been hacking away to make this code work for 3 new forms (e.g. 3 new checkboxes).
While I'm not terribly familiar with VB, I know my way around script and I'm pretty sure I haven't really messed up that code.
How I got there:
At one point in my building of this thing, every time I went to open the 'print' page, I would get an error and drop into VB.
Well, this was driving me nuts, and at that point I hadn't altered the code. I was just trying to view the print page. So, I cleverly pasted into VB the code from an earlier version of the db. This cleared up the debug error nicely, and I was able to finish the code that would allow me to choose 3 new pages to print. But now it's doing the symptom above.
Any help would be appreciated.
Scott
Hey Guys,
I have searched and searched for this on the forum but to no avail. :(
I have just installed Adobe Acrobat 6.0 and so can create PDFs. Does anyone know the code I need for a button on a form to print a report to PDF format?
Many thanks,
Rusty
:D