I want to be able to delete rows from a an access query where a condition (date) is met within the table?
I want to be able to delete rows from a an access query where a condition (date) is met within the table?
im still stuck with this one guys any advise?
anyone know if this can even be done?
I don't understand what you are trying to do. Are you trying to do this within Access or Excel?
Access forumn link
http://www.access-programmers.co.uk/forums/
using excel vb code i would like to delete records from an access table based on a criteria
To do what you asked do so:
1) open excel and then Vb editor (alt + F11)
2) from the menu, choose tools, references and, from the list, choose Microsoft DAO 3.6 object librery
if you don't have 3.6 you can use also 3.51 or another
3) paste this code:
Sub DeleteRecords()
Dim db As Database
Dim dbName As String
Dim query As String
dbName = "c:\<path>\<db name>.mdb"
'connect to access database
Set db = dbengine.Workspaces(0).OpenDatabase(dbName)
query = "delete from <rable name> where <field name> = 'criteria'"
if your field is numeric don't use quote in criteria:
query = "delete from <rable name> where <field name> = criteria"
'deleting
db.Execute (query)
db.Close
Set db = Nothing
End Sub
Regards.
Antonio
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks