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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing an Access table from Visual Basic 1

Status
Not open for further replies.

JasonV

MIS
Jun 9, 1999
10
0
0
US
Hi,<br>
I'm writing data from a flexgrid to a table in Access 97.<br>
What is the command to clear the table before it is written to?<br>
<br>
Thanks,<br>
Jason
 
Here is one way I have used to clear an Access table:<br>
With [variable name of table here]<br>
If Not (.EOF And .BOF) Then .MoveFirst<br>
Do Until .EOF<br>
.Delete<br>
.MoveNext<br>
Loop<br>
End With<br>
<br>
Hope that helps!<br>
kleo<br>
<br>
kleo9@hotmail.com<br>

 
you could also do this with an sql statement:<br>
<br>
<br>
myDB.execute ("delete * from mytable;")<br>
<br>
where myDB has been properly opened using<br>
<br>
set myDB = dbengine.workspaces(0).opendatabase("c:\mydata.mdb") substitute your own path<br>
<br>
quick easy and fast<br>
<br>
<br>

 
Thanks Positran and kleo. Works fine now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top