Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Browse DataBase table.

Status
Not open for further replies.

drek01

MIS
Apr 1, 2007
87
US
hey guys i want to have a table browser, i know how to implement file browser but i want table browser of database( access Database).
i know this will browse database file but won't open tables( or objects) of that database. so any body please help me out.

Private Sub cmdImport_Click()
Dim invalid As Integer
On Error GoTo Err_cmdImport_Click

Dim msaof As MSA_OPENFILENAME
Dim strTable As String

msaof.strFilter = MSA_CreateFilterString("Access files (*.mdb,*.mde)", "*.mdb;*.mde")
strTable = MSA_GetOpenFileName(msaof)
 
And the idea was not that you would necessarily use that whole other example, but it would provide some of what extra you'd need, and more than that, would provide you something to learn new methods from. If you tie in the methods from that example with the already provided code, then you should be set.

--

"If to err is human, then I must be some kind of human!" -Me
 
A of your post, it creates the temp table using sql statement.it selects the field name from known tables, but how do i do in my case. i have to select table names from databse. please help me with this.


'Create a new temporary table containing the required fields
strSQL = "SELECT tblStaff.Firstname,tblStaff.Lastname " & _
"INTO tblTemp " & _
"FROM tblStaff;"


Thanks guys
 
Thankyou guys for your help. i finnaly figure this out with your help. just changed few lines.


Do While Not rs.EOF
If Not Left$(rs.Fields("TABLE_NAME").Value, 1) = "~" Then
s_str = s_str & rs("Table_Name").Value & ";"

ListTables.RowSource = s_str

End If
rs.MoveNext
Loop
rs.close
Set rs = Nothing
CNN.close
Set CNN = Nothing
DbName = ""

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top