[AccessD] Last Record Problem

Kaup, Chester Chester_Kaup at kindermorgan.com
Mon Oct 20 14:12:58 CDT 2008


The next statement is
NextDate = rs4.Fields(0)

Would this not try to access non-existing data?

Set warnings is set to true.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Monday, October 20, 2008 2:03 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Last Record Problem

Because though you moved past the end of the recordset, you did not try to
access any non-existing data.

As soon as you actually reference a field name you'll get error 3021 - No
Current Record.

Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester
Sent: Monday, October 20, 2008 2:58 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Last Record Problem

Why does the following not generate an error. It seems I would be past the
last record?

strSql = "SELECT TestDate, LinePres, TubingPres, [LinePres]-[TubingPres] AS
Difference " & _
        "FROM tbl_Pressure_Date " & _
        "WHERE (((TestDate)=Date() Or (TestDate)=Date()-7 Or
(TestDate)=Date()-14 Or (TestDate)=Date()-21 Or (TestDate)=Date()-28 Or
(TestDate)=Date()-35 Or (TestDate)=Date()-42)) " & _
        "ORDER BY TestDate;"

Set rs4 = MyDb.OpenRecordset(strSql)

rs4.MoveLast
rs4.MoveNext


Chester Kaup

Engineering Technician

Kinder Morgan CO2 Company, LLP

Office (432) 688-3797

FAX (432) 688-3799





No trees were killed in the sending of this message. However a large number
of electrons were terribly inconvenienced.

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list