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:
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.
I have a project which produces a report of names, addresses, etc. I added a print button to the form to send the report to the printer. The code is as follows:
Private Sub Command32_Click() Docmd.SetWarnings False 'Docmd.OpenReport "rptAddresses", acViewNormal Docmd.RunCommand acCmdPrint Docmd.SetWarnings True End Sub
Both alternatives in the code produce the same result described following.However, the printed report includes only the first 2 colums of about 10 of the 90 plus records. If I send to to a PDF, it works fine. If I do a print view on the screen ir looks fine.
I used the code below to hide all the toolbars and then created my custom ReportToolbar so the user can print the report. All works OK; however, the PRINT button on my custom toolbar sends the report imidiately to the printer. How can I create a button that I could add to my custom toolbox which would open the dialog box that allows to choose the printer, number of pages to print, etc.. (same action as I can get by going to File->Print)?
PS> Also, is there any way to remove the drop down arrow from my custom toolbox? I disabled Customize Toolbox but the pulldown arrow still appears. I found making an MDE would take care of this, but was wondering if there was another solution.
Code used to hide toolbars:For i = 1 To CommandBars.Count CommandBars(i).Enabled = False Next i
Is it possible to get Access to open the print dialogue box instead of printing direct to the default printer when using the print command from a button?
This for an app being used in Access 2003. I'm trying to (sort of) automate naming a PDF report. After the user selects a printer from the print dialog, if the printer name is like "*PDF*" then I want to put the PDF file name in the clipboard so it can be quickly pasted in the file name of the PDF printer's save dialog.
Something like this:
Code: Dim strSelectedPrinter as string DoCmd.OpenReport "rpt1", acViewPreview DoCmd.RunCommand acCmdPrint
[Code]....
but that returns the name of the default printer, not the selected printer.
I have an application (2007 accde) that has been working for some time, this line specifically:
Application.FollowHyperlink Me.txtAttachment
On one users PC (XP Pro SP3), this has worked from day one. His PC got infected to the point that I had to wipe/rebuild it, and suddenly this code throws a warning and then an error. The warning I could live with (it's the MS Office "some files can contain viruses..." warning). However, after clicking on OK for the warning, I get an error that says "Can't print form image to this type of printer". Doesn't make sense, as this user has the same default printer he had before, plus I tried with a different default printer.
if I navigate to the file location on his PC I can open any of the files, so I don't think it's a permissions issue. The code works fine on my PC and a VM with a different OS, and it still works fine for other users.
I want to put a print button on my data entry form that prints the current record in a report that is laid out all nice and pretty. I found this code that works, but it goes straight to the printer - it does not bring up the printer dialog so you can select a printer.
Code: Private Sub RecordPrint_Click() Dim strWhere As String If Me.Dirty Then Me.Dirty = False End If
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.
i'm trying to run a recordset and export the string of each record into a txt file. from all the examples ive seen the way i'm doing it is right but i'm not getting any data to go into the actual file. my loop works perfect (as i watched it in debug mode) and it makes the string, my file just isnt getting outputted.
heres the code:
Private Sub btneParcel_Click()
Dim rs As Recordset Dim strContents As String Dim lngFileNum As Long Const strFileName = "g:worksdatImport01.txt"
Set rs = CurrentDb.OpenRecordset("SELECT * FROM QryeParcelExport") If rs.RecordCount > 0 Then
lngFileNum = FreeFile Open strFileName For Output As #lngFileNum Print #lngFileNum, strContents Close #lngFileNum
MsgBox "Client Data has been successfully exported to G:Import01.txt", vbExclamation
End If
End Sub
anyone able to help with this? actually just reading my code, do i need another new line at the end of my string? think parts are going to one massive line that should be seperate lines...but that should still output something.
I'm very new to Access and especially VBA. How to get started with the correct syntax for locating a file, and printing it. The file will be a PDF and if possible I would like to declare a variable for the file name (not the path) so if it is changed I can just change the variable instead of looking for it in the code. I plan to have 10 of these.
I have a Print button on a form, which actually prints off a report for the user. Some of them seem to be trying File-->Print, which actually just prints the form instead of the report and no matter how many times I've told them to use the Print button, they seem incapable of remembering.
Is there a way to turn off the File-->Print option ?
Using Access 2000, I have a macro to generate a report by updating various make-table queiries. I would like for the macro to print the report to an Adobe PDF file and save the file as the database name.
When I manually print the report, it gives me the opition of selecting printers and Adobe PDF is listed as a printer. After selecting the "printer", a "Save As PDF" menu pops up and currently it lists the Access Report Name. I would like to use the database name as the name of the PDF file.
In short, when I execute the "Generate Report" macro, I want the end product to be a PDF file using the database name as the PDF file name.
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?
I have researched on here how to print the results of a query to a text file. I put the code in and I get an error on the openrecordset line. The error says "too few parameters, expected 4"
I tried the query in another report I export to excel and the query works.
I tried printing the whole table using "Select * from tbl_Customers" and it works????
Here is the code:
Dim rst As DAO.Recordset Set rst = CurrentDb.OpenRecordset("qryBell1", dbOpenSnapshot) Dim fs, TextFile Set fs = CreateObject("Scripting.FileSystemObject") Set TextFile = fs.CreateTextFile(pathname, True)
[Code] ....
the query returns 6 fields for printing and can filter based on whether 3 fields are filled or not on the form - Date, Campaign, Status
I have a report that opens from a command button on a form. The settings on the report are set to pop-up and modal to keep the focus on the report until closed. I like the settings as they are but I need to print the report once it pops up. As the settings go, I cannot access or use the toolbars to print the report. How can I print the report from the pop-up, modal view? :mad:
I'm not sure if this is possible in Access, but I was wondering if there is a way to automatically run an Update query when a report is printed.
More specifically, I have confirmation reports, and I want the date printed and confirmation sent fields to be updated upon printing. I have an update query ready, but because I'm not going to be the person actually doing the work, I'd like the update query to be run automatically.
I have a report that is dependent on the content of a single text box (a student's name). I would like to be able to select multiple names from a listbox and loop through those names to print the reports. So far, no success.
I believe that if I could pass the name of the student during the loop to the text box, the report would print properly.
Below is an attempt to pass the names in the listbox to the textbox.
Set frm = Forms![Student Reports] Set ctl = frm![lstStudentNames]
I have a form which records the progress of a complaint investigation. There are 3 reports I would like to run from this form using command buttons. They are report_long (shows all activity) report_short (summary) and logsheet. The primary key is complt#. How do I ensure that the complaint being printed is the complt# I have on the form?
Please bear with my ramblings, but I’m not sure what you may find relevant.
I am currently doing work for a service company where the employees are required to wear the company’s uniform. When someone joins the company they are required to purchase their own uniform. After a year, the company buys the replacement uniform. Each year on the anniversary date, the employee is given their annual evaluation. At that time they are given a requisition to go to the uniform supplier for new uniform articles.
Each item in the uniform has a life span. For example, shirts and pants are replaced each year, winter coats and spring/fall coats are replaced every three years, caps every two years etc.
I have a form which lists the item no., description and cost of each item and when they are due to be replaced. For example Winter coat last replaced on 2003/11/10, replacement date is calculated to 2006/11/10 When this employee has his evaluation this November, he will be entitled to a new winter coat. The calculations are done by clicking an option button beside the item on the form. Clicking replaces the issue date with Date() and adds three years to the issue date using DateAdd for a new replacement date. Clicking the button also indicates that the item is to be replaced.
NOW, I have all this working.
What I would like to do is find some way of printing the requisition from this form before closing it. Something along the lines of:
If Option1 is yes Print this item on the requisition Endif
And do this on every item on the form, if it’s yes, print it on the requisition, if its no ignore it.
The option buttons are not part of the underlying tables or query only part of the form.
If I’m doing this backwards, please let me know. I’m well ahead of my deadline.
I was wondering if anyone might be able to help me here. I have two tables, staff_table and salary_table.
Staff_table has the following fields, Staff_ID, Staff_FN, Staff_LN,...
Salary_table has the following fields, Sal_ID, Staff_ID, Sal_Date, Pay_Amt,...
In the salary form, i have a listbox that shows records of the joining of the two tables, because i'd like to be able to show the FirstName and LastName of staff. So Staff_table is joined to Salary_table via Staff_ID.
And also, in the form, i have a button to print out whatever's listed out in the listbox. It also has a combobox that is to filter the records by Staff_ID.
The salary report is created using the query named QSalary. QSalary is as a result of the joining of the two tables, Staff and Salary.
I hope i haven't lost you this far.
What doesn't work is when i filter by the Staff_ID of 10(michael), i can see there are a few number of records shown just for michael and i want to have them printed out on the report but it doesn't work. it shows the whole records in the salary table.
Here is my code
nlist = Me.LB_Salarylist.ListCount
For ncount = 0 To nlist - 1 stlinkcriteria = ",'" & Me.LB_Salarylist.ItemData(ncount) & "'" & stlinkcriteria Next ncount
If Len(stlinkcriteria) > 0 Then stlinkcriteria = "[QSalary.Sal_ID] In (" & Mid(stlinkcriteria, 2) & ")" ' i have tried [Sal_ID] and [Salary_table.Sal_ID], none of them work. End If
stDocName = "Salary_SumReport" ' for producing salary summary report
I have a report based on a form and when I view the report in print preview, part of it has been truncated. I have attached a screenshot of it. Is there a better way for me to print the form other than as a report? If not, how do I show the entire report without leaving out any part of it?