I am being stricken with the A2K Name AutoCorrect bug with regards to reports changing margins and orientation. I understand that you can turn this feature off when creating objects, but I am guessing (incorrectly I hope) that this will fix this problem only for my computer.
If this is indeed the case, does anyone know if it's possible to turn autocorrect off as soon as a user opens the database (via a vba module or something)?
Thanks!
Brad.
15 6460
The following article explains how you can manually turn it off, if you need to use VBA let us know I am sure I can something to fit your needs.
"Taking the mystery out of Name AutoCorrect in Access." http://office.microsoft.com/en-us/ac...345661033.aspx
__________________________________________________ ________________
Looks like that link you sent is no longer active (or just a problem with the site).
I have had no problem manually turning off Name AutoCorrect. I just need to know if you manually turn it off before creating Access objects, will this translate to other users PCs using the network version of the database?
If not... I do indeed need some advice on how to use VBA to turn off Name AutoCorrect.
Many thanks!
I do believe this is a turned on and off per database type of an item. So if anyone is using that db then it should be set for them as well.
I do indeed need some advice on how to use VBA to turn off Name AutoCorrect.
That may take some effort I will try and do what I can if you or anyone else manages to find it please post it as it could be useful to others. Thanks
Sweet! That's what I was hoping to hear. I am currently working on the first report I have built from scratch since turning off the AutoCorrect. I'll update you when I try it out.
Well... Making progress, but...
It is now holding the Margins and the landscape orientation of the page, but it loses the "Legal" page size setting (reverts to Letter).
Thoughts?
Brad.
In my module I typed in papersize highlighted it hit F1...Try that for AutoCorrect :)
Help file shows the following:
PaperSize Property
See AlsoApplies ToExampleSpecificsReturns or sets an AcPrintPaperSize constant indicating the paper size to use when printing. Read/write.
AcPrintPaperSize can be one of these AcPrintPaperSize constants.
acPRPS10x14
acPRPS11x17
acPRPSA3
acPRPSA4
acPRPSA4Small
acPRPSA5
acPRPSB4
acPRPSB5
acPRPSCSheet
acPRPSDSheet
acPRPSEnv10
acPRPSEnv11
acPRPSEnv12
acPRPSEnv14
acPRPSEnv9
acPRPSEnvB4
acPRPSEnvB5
acPRPSEnvB6
acPRPSEnvC3
acPRPSEnvC4
acPRPSEnvC5
acPRPSEnvC6
acPRPSEnvC65
acPRPSEnvDL
acPRPSEnvItaly
acPRPSEnvMonarch
acPRPSEnvPersonal
acPRPSESheet
acPRPSExecutive
acPRPSFanfoldLglGerman
acPRPSFanfoldStdGerman
acPRPSFanfoldUS
acPRPSFolio
acPRPSLedger
acPRPSLegal
acPRPSLetter
acPRPSLetterSmall
acPRPSNote
acPRPSQuarto
acPRPSStatement
acPRPSTabloid
acPRPSUser
expression.PaperSize
expression Required. An expression that returns one of the objects in the Applies To list.
Example
The following example sets a variety of printer settings for the form specified in the strFormname argument of the procedure.
Sub SetPrinter(strFormname As String)
DoCmd.OpenForm FormName:=strFormname, view:=acDesign, _
datamode:=acFormEdit, windowmode:=acHidden
With Forms(form1).Printer
.TopMargin = 1440
.BottomMargin = 1440
.LeftMargin = 1440
.RightMargin = 1440
.ColumnSpacing = 360
.RowSpacing = 360
.ColorMode = acPRCMColor
.DataOnly = False
.DefaultSize = False
.ItemSizeHeight = 2880
.ItemSizeWidth = 2880
.ItemLayout = acPRVerticalColumnLayout
.ItemsAcross = 6
.Copies = 1
.Orientation = acPRORLandscape
.Duplex = acPRDPVertical
.PaperBin = acPRBNAuto
.PaperSize = acPRPSLetter
.PrintQuality = acPRPQMedium
End With
DoCmd.Close objecttype:=acForm, objectname:=strFormname, _
Save:=acSaveYes
End Sub
I finally got it working.
As stated before, turning off the Name AutoCorrect made the report hold it's margins and Landscape orientation. However, the Paper Size continued to revert to Letter.
I ended up placing this code in the command button that opened the report... DoCmd.OpenReport "MyReport", acViewPreview MsgBox ("You must choose Paper Size: 'Legal' to view/print properly") SendKeys "{RIGHT}" SendKeys "{TAB}" SendKeys "{TAB}" SendKeys "%{DOWN}" RunCommand acCmdPageSetUp
This opened Page SetUp and opened the dropdown box for choosing the paper size.
Thanks for all of your replies and direction Denburt!
Brad.
I am glad you managed to get it working however, I so hate sendkeys... Yes they can get things done but they can be very problematic to say the least. I did a little digging and found the following article and I am sure you will find this useful. http://support.microsoft.com/kb/290293
The link provides two methods of setting the default printer to legal as well as other properties and I am sure they will produce much more reliable results.
Indeed this appears that it would be a much better method of accomplishing this task. However, it appears that it will only work on Access 2002, 03 and 07. This database is written in 2k. I have however marked this page for use on my next '03 Db!
Thanks again for your help.
Brad.
You got me on that one drn everyone wants to complain today... lol Try this one, it is 2k compliant, I am so very stubborn. :) http://support.microsoft.com/kb/302416/en-us
Sorry just realized it needs to open it in design view also... I will keep looking.
You are quite stubborn... but if it ends up solving this one... I'll forgive a little stubborness :)
Stuborn me I am back with more. I found two articles on printing using win32 API's if you think this may work for you let us know and we may be able to help with any conversions.
The code I am about to paste needs some work for printing a form etc. Basic printing to a default printer (worked for me) using the string in the code. I didn't try to make any adjustments to try and print a form. The one thing is the user will not see any dialog box, this can be remedied but you would need to design one.
The following article in this link refers to an issue with duplex printing however the code could possibly work with a few adjustments. http://support.microsoft.com/kb/828638
This link is where I found the following code. The article states that this is for VB but it will work for VBA. I also made a few adjustments btw. http://support.microsoft.com/kb/q154078/ - Option Compare Database
-
Option Explicit
-
Private Type DOCINFO
-
pDocName As String
-
pOutputFile As String
-
pDatatype As String
-
pPaperSize As Integer
-
End Type
-
Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal _
-
hPrinter As Long) As Long
-
Private Declare Function EndDocPrinter Lib "winspool.drv" (ByVal _
-
hPrinter As Long) As Long
-
Private Declare Function EndPagePrinter Lib "winspool.drv" (ByVal _
-
hPrinter As Long) As Long
-
Private Declare Function OpenPrinter Lib "winspool.drv" Alias _
-
"OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, _
-
ByVal pDefault As Long) As Long
-
Private Declare Function StartDocPrinter Lib "winspool.drv" Alias _
-
"StartDocPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, _
-
pDocInfo As DOCINFO) As Long
-
Private Declare Function StartPagePrinter Lib "winspool.drv" (ByVal _
-
hPrinter As Long) As Long
-
Private Declare Function WritePrinter Lib "winspool.drv" (ByVal _
-
hPrinter As Long, pBuf As Any, ByVal cdBuf As Long, _
-
pcWritten As Long) As Long
-
-
Public sub RunPrint()
-
Dim lhPrinter As Long
-
Dim lReturn As Long
-
Dim lpcWritten As Long
-
Dim lDoc As Long
-
Dim sWrittenData As String
-
Dim MyDocInfo As DOCINFO
-
lReturn = OpenPrinter(Printer.DeviceName, lhPrinter, 0)
-
If lReturn = 0 Then
-
MsgBox "The Printer Name you typed wasn't recognized."
-
Exit Sub
-
End If
-
MyDocInfo.pDocName = "AAAAAA"
-
MyDocInfo.pOutputFile = vbNullString
-
MyDocInfo.pDatatype = vbNullString
-
-
'Not sure of the integer needed for legal play with it and see
-
debug.print MyDocInfo.pPaperSize
- MyDocInfo.pPaperSize = 1
-
-
lDoc = StartDocPrinter(lhPrinter, 1, MyDocInfo)
-
Call StartPagePrinter(lhPrinter)
-
sWrittenData = "How's that for Magic !!!!" & vbFormFeed
-
lReturn = WritePrinter(lhPrinter, ByVal sWrittenData, _
-
Len(sWrittenData), lpcWritten)
-
lReturn = EndPagePrinter(lhPrinter)
-
lReturn = EndDocPrinter(lhPrinter)
-
lReturn = ClosePrinter(lhPrinter)
-
End Sub
Hate to be dense, but compiler didn't like all the Private Declares after the 'End Type'. I looked specifically at the second link that you included and it said to put this code behind a command button. Is there more to it than that? My VBA experience thus far has not included placing all those Private Type, Private Declares and Public Subs one after the other.
Thanks,
Brad.
Did you try and paste this into a brand new module? The you can simply call the subroutine RunPrint and off you go.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: RdR |
last post by:
Hi,
I am using Q Replication, I need to set to logging to capture changes on a
table but the table has more than 18 characters for the name, I looked at
the docs, it mentioned that table names...
|
by: pippo |
last post by:
Hello,
I searched all over, and couldn't find code to change the Application's
autocorrect options through VBA.
Is this possible?
I'm not talking about the Allow AutoCorrect of txt boxes or cbo...
|
by: Jim M |
last post by:
Just got my copy of Access 2003. Is the 'Name Autocorrect' feature in
Access 2003 fixed yet, or is it still 'Name Autocorrupt', as many in
this newsgroup reported in the past.
I would like to...
|
by: Regnab |
last post by:
I'm not sure if this is some random bug in the system, but I keep
getting the #Name? error on one of my forms when I try to link one
field to another. For example, I have one field called...
|
by: Spawn666948 |
last post by:
Hey, do you guys know how to set the Name Autocorrect to unchecked by
default. Name Autocorrect is more trouble than its worth. I know I
can go to Tools/General, but, I'd rather have it unchecked...
|
by: ApexData |
last post by:
WatchOut for "Allow AutoCorrect" in your unbound combobox lookups.
I am building a personnel database, and the last name of Ballance was
causing the following message to popup, prohibiting me from...
|
by: =?Utf-8?B?TG92ZSBCdXp6?= |
last post by:
Good day all.
I am trying to set up MS Access to replace data in a cell using the
AutoCorrect feature in Access. However, when I import a text file (.csv), it
doesn't replace the cell as I have...
|
by: Simon |
last post by:
Dear reader,
By default the "Subdatasheet name" of a table is set to .
If I change the setting to and save the changes the table property
Subdatasheet name is still set to .
|
by: nagar |
last post by:
I need to get the list of Autocorrect entries in word. Is there a way
to do it without connecting to Word? Is the list saved somewhere?
If I need to connect to Word, how can I detect if it's...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |