T
tlyczko
Hello, I have a form where the end user enters a date, chooses the
values for Me.txtCriteria, used in the select query below, then clicks
a button. The form button's onClick event has the code given below:
'select records from tblRecord corresponding to people and topic
strSQL = "SELECT (tblRecord.[Date Completed]), tblRecord.TopicID,
tblRecord.PersonID FROM tblRecord "
strSQL = strSQL & "WHERE (((tblRecord.PersonID) In (" & Me.txtCriteria
& ") AND ((tblRecord.TopicID)=" & Me.cboTopic & ")))"
Set rst_01 = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
'move through each row of the created recordset
Do Until rst_01.EOF
lngPersonID = rst_01.PersonID
Debug.Print "rst1", rst_01(0), rst_01(1), rst_01(2)
'here I want to get a SUBSET of rst_01 corresponding to the current
value of lngPersonID,
'then evaluate each row within the subset and act according
'because I only want to append a record to rst_01 if and only if rst_01
'has NO records with Date Completed equal to the date entered on the
form,
'problem is there are multiple records with the same lngPersonID value
'within rst_01
rst_01.MoveNext
Loop
rst_01.Close
Set rst_01 = Nothing
I have tried the FilterField code from Access help like so:
Set rst_02 = FilterField(rst_01, rst_01.PersonID, lngPersonID)
(I copied the function verbatim into a module.)
I don't know how to convert the above select query to an ADO query or I
would try using ADO to do this...
Thank you, Tom
values for Me.txtCriteria, used in the select query below, then clicks
a button. The form button's onClick event has the code given below:
'select records from tblRecord corresponding to people and topic
strSQL = "SELECT (tblRecord.[Date Completed]), tblRecord.TopicID,
tblRecord.PersonID FROM tblRecord "
strSQL = strSQL & "WHERE (((tblRecord.PersonID) In (" & Me.txtCriteria
& ") AND ((tblRecord.TopicID)=" & Me.cboTopic & ")))"
Set rst_01 = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
'move through each row of the created recordset
Do Until rst_01.EOF
lngPersonID = rst_01.PersonID
Debug.Print "rst1", rst_01(0), rst_01(1), rst_01(2)
'here I want to get a SUBSET of rst_01 corresponding to the current
value of lngPersonID,
'then evaluate each row within the subset and act according
'because I only want to append a record to rst_01 if and only if rst_01
'has NO records with Date Completed equal to the date entered on the
form,
'problem is there are multiple records with the same lngPersonID value
'within rst_01
rst_01.MoveNext
Loop
rst_01.Close
Set rst_01 = Nothing
I have tried the FilterField code from Access help like so:
Set rst_02 = FilterField(rst_01, rst_01.PersonID, lngPersonID)
(I copied the function verbatim into a module.)
I don't know how to convert the above select query to an ADO query or I
would try using ADO to do this...
Thank you, Tom