| | |
Change Access Title in VB6
![]() |
•
•
Join Date: Jun 2006
Posts: 1
Reputation:
Solved Threads: 0
I am desparate, please can someone tell me how I can change a report title in an Access 2000 report from within my VB6 code?
I did something like this but it is not changing thye title
I did something like this but it is not changing thye title
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Sub PrintReport(TheReport As String, TheCriteria As String, TheHeading As String) '------------------------- If access is open then close it -------------- On Error Resume Next objAccess.Quit On Error GoTo NoRecords '------------------------- Open Database -------------------------------- Set objAccess = New Access.Application objAccess.Visible = True objAccess.OpenCurrentDatabase (DatabasePath) objAccess.RunCommand acCmdAppMaximize '------------------------- Open Report and set the Heading -------------- objAccess.DoCmd.OpenReport TheReport, acViewPreview, , TheCriteria If TheHeading <> "" Then objAccess.Reports(TheReport).Controls!lblHeading.Caption = TheHeading End If '------------------------- Set the criteria for report ------------------ If TheCriteria <> "" Then objAccess.Reports(TheReport).Filter = TheCriteria DoEvents End If objAccess.Reports(TheReport).FilterOn = True DoEvents objAccess.DoCmd.Maximize objAccess.Visible = True Exit Sub NoRecords: If Err.Number = 2486 Then Resume Else MsgBox "There are no records that match your request.", vbExclamation, "No Records" End If End Sub
I'm sure it's just something simple, like maybe try refreshing the report after you set the label value? If your really desperate, create a table linked to the table which your report is pulling from to hold different title values and update the table prior to calling your report. Base your report off a query which then pulls your original data plus the newly updated title from the related table.
![]() |
Similar Threads
- MS Access and other applications on VB6.0 (Visual Basic 4 / 5 / 6)
- Pls help me regarding to access database in vb6 (Visual Basic 4 / 5 / 6)
- VB6 and MS Access 2002 (Visual Basic 4 / 5 / 6)
- printing an access table in VB6 (Visual Basic 4 / 5 / 6)
- Hijacking of home Page/access to hotmail (Viruses, Spyware and other Nasties)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: coding IM: notifiyng clients of others online presence
- Next Thread: Value Compare
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





