Group:  Microsoft Access ยป microsoft.public.access.modulescoding
Thread: EOF or BOF Error message help

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

EOF or BOF Error message help
"tiger" <aaa0715[ at ]omega.uta.edu> 02.02.2006 03:45:25
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


Re: EOF or BOF Error message help
"Alex Dybenko" <alexdyb[ at ]PLEASE.cemi.NO.rssi.SPAM.ru> 02.02.2006 07:10:14
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
>
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net