It will list out all the views available in the database. Select any view and it will shows all the records with the title :). This is a shortcut for users rather than have to buy another product to do reporting like seagate or brio.
p/s i just copy and paste the code below, it seems scattered, rearrange it to make it work again. Another thing create a button to run "PopulateDB" sub first. Contact me if u have any enquiries :)
Code:
Sub Report()
Dim session As Object
Dim r As Integer
Dim db As Object
Dim view As Object
Dim doc As Object
Rview$ = Worksheets("Sheet1").DropDowns("Report
List").List(Worksheets("Sheet1").DropDowns("Report List").Value)
Dbase$ = Worksheets("Sheet1").DropDowns("Db
List").List(Worksheets("Sheet1").DropDowns("Db List").Value)
Set session = CreateObject("Notes.NotesSession")
Set db = session.GETDATABASE("AMMBNOTES", Dbase$)
Set view = db.getView(Rview$)
Set doc = view.GETFIRSTDOCUMENT
r = 1
On Error GoTo ErrRoutine
While Not doc Is Nothing
VC = doc.COLUMNVALUES
c = 1
For Each d In VC
Worksheets("Sheet1").Cells(r, c).Value = d
c = c + 1
Next
vr = r + 1
Set doc = view.GETNEXTDOCUMENT(doc)
Wend
Set doc = Nothing
Set view = Nothing
Set view = Nothing
Set db = Nothing
Set session = Nothing
Exit Sub
ErrRoutine:
If Err = 1005 Then Resume Next Else MsgBox Err
End Sub
Sub PopulateView()
Dim session As Object
Dim r As Integer
Dim db As Object
Dbase$ = Worksheets("Sheet1").DropDowns("Db
List").List(Worksheets("Sheet1").DropDowns("Db List").Value)
Worksheets("Sheet1").DropDowns("Report List").RemoveAllItems
Set session = CreateObject("Notes.NotesSession")
Set db = session.GETDATABASE("AMMBNOTES", Dbase$)
dbVIEW = db.VIEWS
r = 1
For Each view In dbVIEW
Worksheets("Sheet1").DropDowns("Report List").AddItem (view.Name)
r = r + 1
Next
Set dbVIEW = Nothing
Set db = Nothing
Set session = Nothing
End Sub
Sub PopulateDB()
Dim session As Object
Dim dbdir As Object
Dim db As Object
Worksheets("Sheet1").DropDowns("Db List").RemoveAllItems
Set session = CreateObject("Notes.NotesSession")
Set dbdir = session.getDbDirectory("AMMBNOTES")
Set db = dbdir.getFirstDatabase(1247)
While Not db Is Nothing
Worksheets("Sheet1").DropDowns("Db List").AddItem (db.filepath)
Set db = dbdir.getNextDatabase
Wend
Set dbdir = Nothing
Set session = Nothing
End Sub
This was first published in December 2000