Q: Access-DB and VB5.0
Do you know how to get a listing of Tables in an Access Database-file,
then compare user-input (Simple Login-screen), to the list?
breiner@post1.tele.dk (Breiner, Allan)
make a new form with a command button. Set the code in the click
event. Change the [yourdatabase] with the location and name of the
database you want to check.
Then press F5 and click the command button.
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
Return