Hi Javed,
I don't know of any way that you can get all the table names in SQL,
however it is quite easy in VBA.
' Will build a list of tables that be safely deleted
Public Sub BuildTableList()
Dim strTable As String
Dim rs As New ADODB.Recordset
Dim sql As String
Dim intTables As Integer
Dim varLoopVar As Variant
sql = "DELETE * FROM tblTable"
With DoCmd
.SetWarnings False
.RunSQL sql
.SetWarnings True
End With
sql = _
"SELECT TableName " & _
"FROM tblTable"
rs.Open sql, CurrentProject.AccessConnection, adOpenDynamic,
adLockOptimistic
For Each varLoopVar In CurrentData.AllTables
strTable = varLoopVar.Name
With rs
.AddNew
!TableName = strTable
.Update
End With
Next
Set rs = Nothing
End Sub
This code will delete everything from tblTable and insert the name of
every table contained within the current database.
Good luck
Nick
Javed wrote:
Hi,
is there a way to get a list of tables in MDB file? Ideally I want to
write an SQL similar to
'select * from tab' of oracle.