Nate Pet
Nate Pet

Reputation: 46272

.EOF VB, VBA for End Of File

Pertaining to VBA:

Does the following mean if a record does not exist:

    strSQL = "Select * from tblRes  where ID = '" & Forms!Pg!PID & "'"
    rs.Open strSQL, conn, adOpenDynamic, adLockOptimistic
    If rs.EOF Then

Does rs.EOF mean that the select result did not return anything?

Upvotes: 0

Views: 6065

Answers (2)

Matt Donnan
Matt Donnan

Reputation: 5003

When working with ADO recordsets like this one then yes

If rs.EOF

Will confirm there are no records, however it's worth adding that if you are working with DAO recordsets instead then you would amend to

If rs.BOF And rs.EOF

Upvotes: 1

ron tornambe
ron tornambe

Reputation: 10780

Yes. EOF represents an "End Of File" condition.

Upvotes: 0

Related Questions