I have code in Visio that reads a access table, and creates a new tab for each item in the field. I want to have the code look for existing tabs and move to the next one if the tab exists. I guess it would be a nested loop but cannot seem to get it to work. Any help would be greatly appreciated.
Andrew
Andrew
Code:
Public Function fnImportText()
Dim objAccess As AccessObject
Dim Accapp As Access.Application
Dim fso As Scripting.FileSystemObject
Dim rst As DAO.Recordset
Dim db As Database
Dim dbFileName As String
Dim PageObj As Visio.Page
Dim pageNameStr As String
Set Accapp = New Access.Application
Accapp.OpenCurrentDatabase ("extract.mdb")
Set db = CurrentDb()
Set rst = db.OpenRecordset("DatabaseList", dbOpenSnapshot)
Do While Not rst.EOF
dbFileName = rst("Name")
'MsgBox (dbFileName)
Set PagObj = ThisDocument.Pages.Add
Do While PagObj.Name <> dbFileName
PageObj.Name = dbFileName
MsgBox ("Page Exists")
Exit Do
rst.MoveNext
Loop
Loop
'rst.Close
End Function
Comment