J
jayjay21us via AccessMonster.com
I have the following:
Dim dbs As dao.Database
Dim rs As dao.Recordset
Set dbs = Access.application.CurrentDb
Set rs = CurrentDb.OpenRecordset("SELECT DocketID, PLFirst, PLLast, DFFirst,
DFLast FROM HearingSchedule WHERE HearingDate = #" & Forms!Form4!D1 & "#",
dbOpenDynaset)
Do While Not rs.EOF
Forms![Form4].Controls("Mon" & K) = Format(rs!DOCKETID, "####-######") &
Chr(13) & Chr(10) & "PL-" & rs!PLFIRST & rs!PLLAST & Chr(13) & Chr(10) & "DF-
" & rs!DFFIRST & rs!DFLAST
K = K + 1
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
dbs.Close
Set dbs = Nothing
Which works.. But when switch to a date that has no records, the form still
shows the previous record (which had a found date). Do I need to clear the
recordset each time I change dates...
I'm very new at using recordsets.. Any help would be great!!
Dim dbs As dao.Database
Dim rs As dao.Recordset
Set dbs = Access.application.CurrentDb
Set rs = CurrentDb.OpenRecordset("SELECT DocketID, PLFirst, PLLast, DFFirst,
DFLast FROM HearingSchedule WHERE HearingDate = #" & Forms!Form4!D1 & "#",
dbOpenDynaset)
Do While Not rs.EOF
Forms![Form4].Controls("Mon" & K) = Format(rs!DOCKETID, "####-######") &
Chr(13) & Chr(10) & "PL-" & rs!PLFIRST & rs!PLLAST & Chr(13) & Chr(10) & "DF-
" & rs!DFFIRST & rs!DFLAST
K = K + 1
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
dbs.Close
Set dbs = Nothing
Which works.. But when switch to a date that has no records, the form still
shows the previous record (which had a found date). Do I need to clear the
recordset each time I change dates...
I'm very new at using recordsets.. Any help would be great!!