Private Sub Command1_Click()
Dim dWorkspace As Workspace Dim DB As Database, tDB As Database Dim J, I Dim UserInput Dim vFound% UserInput = InputBox("which table do you want to see?") If UserInput = "" Then Exit Sub vFound% = False Set dWorkspace = Workspaces(0) Set DB = dWorkspace.OpenDatabase([yourdatabase]) For J = 0 To dWorkspace.Databases.Count - 1 Set tDB = dWorkspace.Databases(J) 'show databasename 'MsgBox tDB.Name For I = 0 To tDB.TableDefs.Count - 1 If Left$(tDB.TableDefs(I).Name, 4) <> "MSys" Then 'show tablename 'MsgBox tDB.TableDefs(I).Name 'check against userinput If LCase$(tDB.TableDefs(I).Name) = LCase$(UserInput) Then MsgBox tDB.TableDefs(I).Name vFound% = True Exit For End If End If Next I Next J If Not vFound% Then MsgBox "table " & UserInput & " not found..." End Sub |