Hi, looks like your recordset does not return any records - try to paste resulting SQL into new query SQL and run it and do not forget to check for EOF before you call MoveFisrt method:
if not .EOF then .MoveFirst
-- Alex Dybenko (MVP) http://alexdyb.blogspot.com http://www.PointLtd.com
"tiger" <aaa0715[ at ]omega.uta.edu> wrote in message news:%23J$8bq6JGHA.2828[ at ]TK2MSFTNGP12.phx.gbl...
[Quoted Text] > Hi, > > I am getting the following error messages from the code below.... > > Dim rstAccomp As ADODB.Recordset > Set rstAccomp = New ADODB.Recordset > > Dim strSQL As String > > Dim StartDate As Date > Dim EndDate As Date > > strSQL ="SELECT DISTINCT Accomplishment, DDate FROM tblAccomplishment > WHERE > ProgramIpt = '" & SelectedIpt & "' AND DDate > " & Format(StartDate, > "\#mm\/dd\/yyyy\#") & " AND DDate < " & Format(EndDate,"\#mm\/dd\/yyyy\#") > > > With rstAccomp > .Open strSQL, CurrentProject.Connection, adOpenStatic, adLockPessimistic > .MoveFirst > Do Until .EOF > strText = strText & .Fields() & vbTab & .Fields("DDate") > Loop > End With > > if rstAccomp.BOF And rstAccomp.EOF Then > MsgBox "No DATA", vbCritical, Error > End If > > rstAccomp.Close > Set rstAccomp = Nothing > >
|