UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Using Recordset To Delete Data From Table, Access 2016    
 
   
ordnance1
post Jan 11 2017, 12:06 AM
Post#1



Posts: 466
Joined: 7-May 11



Through some researching on-line I have developed this recordset that returns the AbsenceID's (field(2)) from my query qry_Unmatch_Test_AAAA. What I would like to do is then delete the records in tbl_DaysOff that have the corresponding AbsenceID. I am trying not to create a temporary table.

Any help as always would be much appreciated.

CODE
Option Compare Database

Public Sub daoRecordset()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
Dim strValue As String

Set db = CurrentDb
Set qdf = db.QueryDefs("qry_Unmatch_Test_AAAA")

Set rs = qdf.OpenRecordset

If Not (rs.EOF And rs.BOF) Then
Do While Not rs.EOF
    strValue = rs.Fields(2).Value
Debug.Print strValue
rs.MoveNext

Loop

rs.Close
Set rs = Nothing
Set qdf = Nothing
Set db = Nothing

End If
End Sub
Go to the top of the page
 

Posts in this topic



Custom Search
RSSSearch   Top   Lo-Fi    26th July 2017 - 03:38 PM