Re: FATAL ERROR WHEN SENDING ACCESS REPORT TO PDF....
From: Mike S. S. (MikeSS_at_discussions.microsoft.com)
Date: 08/23/04
- Next message: Jim Pockmire: "Word wrap in a text box"
- Previous message: Jim Pockmire: "Problem with previewing legal size report"
- In reply to: Allen Browne: "Re: FATAL ERROR WHEN SENDING ACCESS REPORT TO PDF...."
- Next in thread: Mike S. S.: "Re: FATAL ERROR WHEN SENDING ACCESS REPORT TO PDF...."
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 23 Aug 2004 09:51:02 -0700
Allen, thank you for your help. I did exactly what you suggested and still
had the problem. So I moved through the Switchboard's code line by line
removing lines after a certain point and launching my form with the report
print button on it. All works well (i.e., printing to Adobe PDF) until the
follow line of code is executed:
Private Sub FillOptions()
' Fill in the options for this switchboard page.
' The number of buttons on the form.
Const conNumButtons = 9
Dim con As Object
Dim rs As Object
Dim stSql As String
Dim intOption As Integer
' Set the focus to the first button on the form,
' and then hide all of the buttons on the form
' but the first. You can't hide the field with the focus.
Me![Option1].SetFocus
For intOption = 2 To conNumButtons
Me("Option" & intOption).Visible = False
Me("OptionLabel" & intOption).Visible = False
Next intOption
' Open the table of Switchboard Items, and find
' the first item for this Switchboard Page.
Set con = Application.CurrentProject.Connection
stSql = "SELECT * FROM [Switchboard Items]"
stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" &
Me![SwitchboardID]
stSql = stSql & " ORDER BY [ItemNumber];"
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 1 ' 1 = adOpenKeyset
...the "rs.open stSql, con, 1" is the offending line of code. Once executed
the print produces the fatal error. If I issue a docmd.openform anywhere
before this line of code, the print works perfectly. I am not sure how to
work around the problem and stil use the Switchboard. Any ideas why this
exact line of code creates some situation in the environment to cause the
fatal crash? It may not seem to make sense, but I have very carefully
limited it down to this spot.
If you have ANY ideas/suggestions either on why or how to fix/workaround, I
would really appreciate it. THANKS MUCH!
"Allen Browne" wrote:
> Hi Mike
>
> The fact that it works one way and not the other suggests that there is some
> kind of corruption in your database.
>
> 1. Turn off Name AutoCorrect
> Uncheck the boxes under Tools | Options | General Name AutoCorrect.
> Reasons:
> http://members.iinet.net.au/~allenbrowne/bug-03.html
>
> 2. Compact the database to get completely rid of the Name AutoCorrect junk:
> Tools | Database Utilities | Compact
>
> 3. Decompile a copy of the database by entering something like this at the
> command prompt while Access is not running. It is all one line, and include
> the quotes:
> "c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
> "c:\MyPath\MyDatabase.mdb"
>
> 4. Compact again.
>
> 5. Remove any references you do not need, by opening a code window and
> choosing References from the Tools menu. Typically you need Access, VBA, and
> DAO. More info:
> http://members.iinet.net.au/~allenbrowne/ser-38.html
>
> 6. Compile. The compile will fail if you removed too many references, or if
> there are problems with the code.
>
> If it still fails, the next step is to create a new (blank) database, turn
> off Name AutoCorrect, set your references, and import everything (File | Get
> External | Import). This forces Access to recreate all your objects.
>
> BTW, when Acrobat installs, it loads the Acrobat Assistant into your Windows
> Start menu. It is important that you do NOT remove this item, i.e. you need
> to allow AcroTray.exe to load when Windows starts.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Mike S. S." <MikeSS@discussions.microsoft.com> wrote in message
> news:279A17D0-F6C5-411C-BFEB-61E52F5906EA@microsoft.com...
> > Well, I have narrowed down the problem. The form where the command button
> > is
> > that launches the report when opened directly works fine and the report
> > will
> > output to a PDF when that is chosen as the printer. HOWEVER, I do use the
> > MS
> > built-in switchboard as a menu system, and when I launch the form from
> > that
> > menu and then click the button to produce the report and do a File/Print
> > to
> > the Adobe PDF, it crashes! So the culprit lies somewhere in something
> > that
> > the Switchboard does in launching the form. Could the FilterOn=True that
> > the
> > Switchboard does have something do to with it?
> >
> > Anyone have any ideas at all???????????
>
>
>
- Next message: Jim Pockmire: "Word wrap in a text box"
- Previous message: Jim Pockmire: "Problem with previewing legal size report"
- In reply to: Allen Browne: "Re: FATAL ERROR WHEN SENDING ACCESS REPORT TO PDF...."
- Next in thread: Mike S. S.: "Re: FATAL ERROR WHEN SENDING ACCESS REPORT TO PDF...."
- Messages sorted by: [ date ] [ thread ]