Re: Bug in Access 2002 Reports
From: Stephen Lebans (ForEmailGotoMy.WebSite.-WWWdotlebansdotcom_at_linvalid.com)
Date: 05/21/04
- Next message: Jesse Aviles: "Re: Bug in Access 2002 Reports"
- Previous message: Ragnar Midtskogen: "Re: 2 Sets of Totals"
- In reply to: Jesse Aviles: "Re: Bug in Access 2002 Reports"
- Next in thread: Jesse Aviles: "Re: Bug in Access 2002 Reports"
- Reply: Jesse Aviles: "Re: Bug in Access 2002 Reports"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 20 May 2004 21:20:43 -0300
Sorry Jesse, your explanation is not sinking in!
:-(
You must change your code so that you modify each section's height, and
its controls contained within, for every single possibility...period.
Also I have had problems, from within the Detail Section format event
doing:
Me.Height
I always use:
Me.Section(acDetail).Height
-- HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit. "Jesse Aviles" <monk@coqui.net> wrote in message news:99E01DB4-8716-4FD1-AB5F-4B35107BDE73@microsoft.com... > Mr. Lebans: > > I have two fields that contain a number that specifies a depth. I want two have a report that makes the detail section taller or smaller depending on the difference between these two fields. This will give the report a feeling of being "to scale", when you look at it you can see there are smaller, larger or equal intervals. For example: > Top Bottom Difference > 0 2 2 > 2 6 4 > 6 8 2 > Looking at the above, you can see that two interval are equal and one interval is larger. I want this difference to be observed visually ally in the report, as follows: > Top Bottom ------------------------------------------------------| > 0 | > | > 2 ------------------------------------------------------------| > 2 | > | > | > | > | > 6--------------------------------------------------------------| > 6 | > | > 8--------------------------------------------------------------| > > When you look at the code, you will see an equation that will take care of performing the substraction to determine the difference between the two fields. The result of the substraction is the number that is then provided to the Detail.Height property to set the Height of the detail section as every record is formatted. First problem comes when only the lower part of the code is used (enclosed in an If...Then...Else statement). Access will format the section but it will remember the last placement of the controls. This behavior makes the section taller and not smaller (it doesnt matter that the code is instructing Access to make the section smaller). When Access prints the report, the print out comes the same way as on screen but the behaviour (placement of controls) is faulty. That is why the first half of the code is important. It places the controls at the top of the section every time the section is formatted forcing Access to use the behavior intended in the code. Access complies and formats the section as I intend making the display look "to scale". Problem is the print out will not show the controls placed as in the screen. I hope this makes the problem clearer. Thank you. > > > ----- Stephen Lebans wrote: ----- > > Without even trying to figure out what you are trying to accomplish, > with A2K or higher you can set the Height of the Detail section directly > in the section's Format event. > Me.Section(acDetail).Height = whatever > > -- > > HTH > Stephen Lebans > http://www.lebans.com > Access Code, Tips and Tricks > Please respond only to the newsgroups so everyone can benefit. > > > "notbitmonk" <anonymous@discussions.microsoft.com> wrote in message > news:09586AC6-F02E-494B-8AB6-403A5570A519@microsoft.com... > > I have a procedure attached to the format event of the detail section > of a report. The code works great. I can see the report with the layout > that I want (code in the format events takes care of positioning field > boxes and creating a "scaled" report"). Problem is that when I send the > report to print, the printout does not has any of the format that I see > on the screen (I print it to a Lexmark X1550 and to PDF). The > formatting is lost even if I export to snapshot. If you look at the > code you will see that is divided in two sections. The first section > positions the fields at the top of the detail section. This is done > because Access wil "remember" the last height of the section and > continue using it until a larger height is provided, it doesnt matter > that the code is giving instructions to make the section smaller. If > the first part of the code is not included, the report will come out > "half-scaled", meaning that it will make the section bigger and not > smaller. Also, when the report is printed, I start getting error the > the control is too big for the section but I dont see any extra space > and the report will print. If I try attaching the code to print event, > I just get a bunch of errors because properties are not available at > Print time. Thank for any help. Here is the code: > >> Option Compare Database > > Option Explicit > > Dim intDepth As Integer > >> Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) > > 'Scales detail section to fit boring log > >> On Error GoTo ErrorHandler > >> If IsNull(intDepth) Then > > intDepth = 0 > > End If > > 'Position controls at the top to prevent misplacement > > DepthTop.Top = 0 > > DepthBottom.Top = 0 > > USCS.Top = 0 > > Description.Top = 0 > > SampleSelected.Top = 0 > > GWObserved.Top = 0 > > timeHour.Top = 0 > > sngResults.Top = 0 > > sngRecovery.Top = 0 > > Detail.Height = 300 > > Line41.Height = 300 > > Line42.Height = 300 > >> If (Nz(DepthBottom) - intDepth) > 1 Then > > Detail.Height = (DepthBottom - intDepth) * 300 > > intDepth = DepthBottom > > DepthTop.Top = 0 > > DepthBottom.Top = Detail.Height - 300 > > USCS.Top = Detail.Height - 300 > > Description.Top = Detail.Height - 300 > > SampleSelected.Top = Detail.Height - 300 > > GWObserved.Top = Detail.Height - 300 > > timeHour.Top = Detail.Height - 300 > > sngResults.Top = Detail.Height - 300 > > sngRecovery.Top = Detail.Height - 300 > > Line41.Height = Detail.Height > > Line42.Height = Detail.Height > > End If > >> ExitHandler: > > Exit Sub > >> ErrorHandler: > > MsgBox "Error: " & Err.Number & vbNewLine _ > >& "Description: " & Err.Description, vbMsgBoxHelpButton, "Error > during > > format", Err.HelpFile, Err.HelpContext > >> GoTo ExitHandler > >> End Sub > >> -- > > Jesse AvilÃf©s > > monk@coqui.net > >
- Next message: Jesse Aviles: "Re: Bug in Access 2002 Reports"
- Previous message: Ragnar Midtskogen: "Re: 2 Sets of Totals"
- In reply to: Jesse Aviles: "Re: Bug in Access 2002 Reports"
- Next in thread: Jesse Aviles: "Re: Bug in Access 2002 Reports"
- Reply: Jesse Aviles: "Re: Bug in Access 2002 Reports"
- Messages sorted by: [ date ] [ thread ]