I got many things try but it always an error somebody know this problem? i want to delete all data using only one command button. :(

BitBlt commented: Not real big on details, are you? -1

Recommended Answers

All 4 Replies

Not enough detail to go on. What have you tried? What does your database look like in terms of table structure? Do you mean delete all the data in one table? Do you mean all the data in all the tables? Do you mean drop the tables completely?

Even i am trying for the same think i want to delete all the data which is stored in the sql table . I dont want to drop the table but only want to delete all the data from one table using a command button.......plz help :(:(

If using ADO then try this

conn.begintrans 'conn-----adodb connection object
conn.execute "delete from table_name"
conn.committtrans

here's one I use sometimes. It gets the names of all user tables in the database and puts them in a comma delimited string. You can modify it to do whatever you want.


Function GetTableNames() As String

Dim tdf As TableDef
Dim dbf As Database
Dim sql As String

Set dbf = CurrentDb()
sql = ""

For Each tdf In dbf.TableDefs
If Left(tdf.Name, 4) <> "msys" Then
sql = sql & tdf.Name & ","
End If
Next
GetTableNames = Left(sql, Len(sql) - 1)
dbf.Close
Set tdf = Nothing

End Function

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.