Modules & VBA :: Automated Printer Selection And Page Setup?
Mar 7, 2014
Is it possible, within an OnOpen even of a specific report, to set the printer selection and page setup (size, margins, etc.) to certain things? If so, how would I go about accomplishing this?
I would like to do this for specific users within our domain (this I won't have any trouble with).
I opened my database on a newly installed access programme (same version) to notice that the design control page settings had reverted to default for all my forms and reports. I need them to be A4 and not letter when it is opened on any access system. How could I go about doing this? In Code?
Hi I have created some reports but find difficult to keep permanganate page set up for that reports. I go to design view and do page setup with required margin and Portrait or Landscape set up and preview that reports looks fine. After saving again I check still its fine but once I close that database and reopen again some of reports page setup becomes Portrait with 1" margin on all sides (Not All reports). I cannot solve this. Can any one help?? Funny part is even I copy that report and change data source of that report it changes page setup :confused:
I have several reports in my system. Some are landscape and some are portrait. Occasionally the landcape ones switch to portrait taking up two pages each. In preview mode it is not so bad that the user can reset the page size, but when one is sent to print this is most certainly annoying.
Does anyone know what code or macro you could use to automatically zoom a report to "fit" the screen in the print preview state? Thanks in advance for any help!
I am having a few issues with my module code in Access 2002. for some reason every time I write some code Access is automatically making the first letter a capital so for instance [Our Ref] should be [Our ref] but it simply will not let me do it!
I created a database with a list of companies, with many details in separate tables linking them - shareholders, directors, address etc.
Now i want to create something where the user will be able to just Select the company, and the information would be shown below just for that company. I would want to design of course in order to appear nice.
I have a text box control in a form that is bound to a table field. The field is of numeric format that stores time duration in minutes. I would like to apply sort of transparent / automated conversion. It would work so follows:
- when someone read records, the text box would convert a integer number stored in the filed into text so that the text box would show the time duration in this form "HH:MM" - when someone clicks on the text box to change the value, one would input the value in this form again "HH:MM" but the text would be converted to minutes and then stored in the database.
A while ago I started to use the following code to list the printers installed on a computer. This is code by Wayne Phillips.
This works well, but what if instead of simply getting a big message box with all the printers listed I wanted to be able to click on a name and set that printer? How do I do that?
Code for the button:
Private Sub cmdListPrinters_Click() Dim strCount As String Dim strMsg As String Dim prtLoop As Printer On Error GoTo ShowPrinters_Err
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.
Can you send a report directly to the printer? We have Clients with multiple Contact Notes, by multiple Clinicians, each of these are separate tables. Every month we print two reports for each client that had at least one contact in that date-range. Usually 200 clients, takes a lot of time. My approach so far is a query within a make-table query to get a list of unique client ID's that had one contact in the date-range. Then I use that table in code to create a recordset, use a Do Loop within that where I print the two reports for the 1st client, move to next record and loop. Now that I've got it working I'm not sure how to print all the reports My 1st question, can you send a report directly to the printer from code? The printer is a networked Konica Minolta Biz-hub so I think it can handle that many jobs being queued that fast.
We have an Access database that opened some cash drawers attached to the computer through USB and it is working perfectly. We have some of the cash drawers that are attached to the EPSON Receipt printer and we also want to open those Cash Drawers attached to the receipt printer. Looking for code to open the cash drawer attached to the receipt printer, Is there any command available that I could send to the receipt printer and it would open the Cash Drawer.
I have also taken the screenshot of the utility program that will show the information regarding the printer and I am very expecting to get this working soon as we have build the Microsoft Access database that would checking the cash drawer status and also open the USB cash drawers.
I currently have two e-mail accounts on my computer. One is my default e-mail address with my name on it. The other e-mail account is a generic account with the department name.
I have a database set up to generate and send e-mails to our technicians notifying them when an order they placed gets put on back order. This database could possibly send twenty or thirty e-mails out each time it is run. My manager has requested that the database send the e-mails from the generic e-mail account instead of the default account. That way, when the field replies to the e-mail, they won't bombard my account.
Is there a way to tell the database which e-mail account to send an e-mail from?
I am currently using the below module to send the e-mails:
Option Explicit Dim appOutlook As Outlook.Application Dim namespaceOutlook As Outlook.NameSpace Sub Outlook_SendMail(sEmailAddr As String, sEmailSubj As String, sEmailBody As String, Optional sAttach1 As String, Optional sAttach2 As String)
I am trying to set up a listbox with an option to select multiple items (I have done this and tested it with debug.print and it seems to work). I am then building a filter statement with VBA. I want to then use a button to add this statement to the filter in a subform with (a datasheet design), and then requery it.
My code below seems to be working in part. But I am getting all the items at times. Seems to work consistenly when selecting one item only, but I can't see anything wrong with my 'OR' statements when I debug.print.
Private Sub Command176_Click() Dim i As Integer Dim strFilter As String Dim blnFirst As Boolean i = 0 If Me.List163.ItemsSelected.Count = 0 Then
Basically im trying to setup a click button that will export my query as a text file ( the text file will then be fixed width and i have already setup the specifications for this).
I think i get how to complete the export part as below
OutFilePath = "file location i want the data to be exported to"
I have an automated email system (Lotus Notes) in a Access database I have created and am looking for the code needed to add up to 3 c.c addresses into an email prior to sending automatically.
The code I have to send the email to the To: individual is all working but what code I need to add and where for the c.c addresses of which there could be 1, 2 or 3. The control for To address is EmailTo = CustCopyEmail The controls for the 3 c.c emails are cc_EmailAddress, cc_EmailAddress1 and cc_EmailAddress2.
Here's the code I have:
Private Sub SEND_CC_Click() ' Set up the objects required for Automation into Lotus Notes. Dim Maildb As Object 'The mail database. Dim Session As Object 'The Lotus Notes session. Dim MailDoc As Object 'The mail document itself. Dim UserName As String 'The current users Lotus Notes name.
I'm using VBA to insert the page number in a header. It's working, exept for a couple of things. I want it to insert the page number at the current position, and restart numbering at each section. I increment the section # with the variable x. Currently, it's inserting the page number at top-left of header. I want it to insert the page number after the word "Page" followed by 2 lines breaks.
Is it possible to do conditional formating after a page break?
I have been given someone elses mess to clean up. It is a massive procedure which runs dozens of queries, then formats the results and pastes them into a word file at given bookmarks
For most tables there is one record for each lake. However there are several where many entries per lake. The logic being applied is that the font colour for the column is made white, then for each first instance of a lake name the font colour for that cell is made black again.
The problem is there are many times were the first row of data on a new page is not the first record for a particular lake making the reader have to flip back to the previous page to double check which lake they are looking at data for.
So what I want to do is leave the existing logic, and just add turning additional cell's (Column 1, after a page break) font colour back to black.
I have a form where I add a new event, and it gets added to a list box in another form, I was intending to select the most up-to-date record within the list box but it seems to keep selecting the old latest record and not the new record that ive added. I had tried to select the first record but then move to the last record hoping it would refresh but that still doesn't work.
This is the code I used below:-
Quote:
'Select last event record added to event list box Me.lstPatientEvents = Me.lstPatientEvents.ItemData(Me.lstPatientEvents.L istCount - 1) lstPatientEvents.Selected(lstPatientEvents.ListCou nt - 1) = True
I am simply trying to find text on a Web Browser Control htm page.
Using MS Access 2003, I have a form that includes the activeX Web Browser Control. On load of the form I initialize the web like below:
Code: Dim strURL As String strURL = "http://www.justice.gov/eoir/profcond/chart.htm" Me.WebBrowser0.Navigate strURL Me.WebBrowser0.Silent = True
The page loads fine.
Now, also, on my form is an unbound text box I call: [txtFind] and a command button I call [cmdFind]. I want [cmdFind] to find the first occurrence of the value in [txtFind]. My code below doesn't do anything when I click the [cmdFind] button.
Code: Public oRange As Object Public myfindFirst As Boolean Public intTextLength As Long Private Sub cmdFind_Click() Dim sSearch As String Dim strText As String