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!

Delete * from a Table in Another Database

Status
Not open for further replies.

Fattire

Technical User
Nov 30, 2006
127
US
Can I call this 'delete records query' below to delete all the records in a table that resides in another access DB? Both databases reside on the same shared drive.

del = "Delete * from tblInvoices"
rst.Execute del, Con

 
del = "Delete * from tblInvoices in 'c:\xxx\xxx\xxx.mdb'"
rst.Execute del, Con

or you can link the table
 
Yes Remou I wasn't being clear there...

pwise your suggestion worked, thank you, that would have taken me forever to figure out. Here's what it ended up being:

Private Sub cmdPurgeMainTable1_InMainDB_Click()

Dim rst As ADODB.Recordset
Dim con As ADODB.Connection
Set con = CurrentProject.Connection

del = "delete * from tblMainTable1 in 'C:\Main.mdb'"
con.Execute del

End Sub
 
You could have said:

[tt]strCon = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\main.mdb;"
con.Open strCon

del = "delete * from tblMainTable1"
con.Execute del[/tt]



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top