i need to grab the MinOfPayDate form a tbl.....and us that MinOfPayDate as the parameter for a deletion qry. more specifically ">=MinOfPayDate "
am i making the vba for that function too difficult:
here is my attempt:
i've yet to be able to test but i'm sure there is a better way....i morphed this from the vba used to append data with a parameter
tuk
am i making the vba for that function too difficult:
here is my attempt:
Code:
Function DeleteNecessaryData()
Dim rsDeleteDate As Recordset
Dim x As Integer
Dim SQLT As String
Dim strDate As String
Dim flds As DAO.Fields
Dim fld As DAO.Field
Set rsDeleteDate = CurrentDb.OpenRecordset("MinDate")
'this defines the desired field in the qry to be the parameter
Set flds = rsDeleteDate.Fields
Set fld = flds("MinOfPayDate")
With rsDeleteDate
.MoveFirst
Do While Not .EOF
strDate = fld
Const QRY_APPEND = "Delete30days"
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Set db = CurrentDb
'this is the delete query
Set qd = db.QueryDefs("Delete30days")
qd.Parameters(0) = strDate
qd.Execute
rsDeleteDate.MoveNext
Loop
End With
Set rsDeleteDate = Nothing
'strPayCountry = Nothing
Set fld = Nothing
Set flds = Nothing
End Function
i've yet to be able to test but i'm sure there is a better way....i morphed this from the vba used to append data with a parameter
tuk