If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
Bug in Access 2002 Reports
Glad you got it working.
:-) -- HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit. "Jesse Aviles" wrote in message ... Mr. Lebans: The report is printing correctly from the preview. I did not use the For..Next statement relying instead of counters and resetting the global variables depending on the counters values. The code on the calling form includes an Open Argument when it calls forth the report since I wasn't able to use the filter property of the report. Following is the final code I used. Option Compare Database Option Explicit Dim intDepth As Integer Dim intCounter As Integer Dim intRecordCount 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 at 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 'Calculate space and set controls in their position Debug.Print "DepthBottom before calculation " & DepthBottom Debug.Print "intDepth before calculation " & intDepth Detail.Height = (DepthBottom - intDepth) * 300 Debug.Print "Calculation Value " & (DepthBottom - intDepth) intDepth = DepthBottom 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 intCounter = intCounter + 1 If intCounter = intRecordCount Then intDepth = 0 intCounter = 0 End If Debug.Print "DepthBottom after calculation " & DepthBottom Debug.Print "intDepth after calculation " & intDepth Debug.Print "Detail height after calculation " & Detail.Height Debug.Print "intCounter = " & intCounter Debug.Print "intDepth after intCounter if statement " & intDepth Debug.Print "--------------------------------------------------" ExitHandler: Exit Sub ErrorHandler: MsgBox "Error: " & Err.Number & vbNewLine _ & "Description: " & Err.Description, vbMsgBoxHelpButton, "Error during format", Err.HelpFile, Err.HelpContext GoTo ExitHandler End Sub Private Sub Report_Open(Cancel As Integer) intRecordCount = DCount("DepthTop", "qryFullBoringLog", Me.OpenArgs) Debug.Print "intRecordCount = " & intRecordCount End Sub The code of the command button on the calling form is: Private Sub cmdPreviewrptBoringLog_Click() On Error GoTo ErrorHandler Dim stDocName As String Dim strLinkCriteria stDocName = "rptBoringLog" strLinkCriteria = "[BoringInfoID] = " & Me!BoringInfoID DoCmd.OpenReport stDocName, acPreview, , strLinkCriteria, , strLinkCriteria ExitHandler: Exit Sub ErrorHandler: MsgBox "Error Number: " & Err.Number & vbNewLine & "Description: " _ & vbCrLf & Err.Description, vbMsgBoxHelpButton, "Error in Execution", Err.HelpFile, Err.HelpContext Resume ExitHandler End Sub Once again thank for your time, patience and help. Jesse Avilés |
|
Thread Tools | |
Display Modes | |
|
|