Kaup, Chester
Chester_Kaup at kindermorgan.com
Tue Oct 21 07:33:21 CDT 2008
Rather than spend a lot of time figuring out what is going on I just stuck in an EOF check statement.
-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Monday, October 20, 2008 4:02 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Last Record Problem
Well the question was
"Why does the following not generate an error. It seems I would be past the
last record?"
<snip SQL>
rs4.MoveLast
rs4.MoveNext"
You kept the next line of code a secret. :-)
NextDate = rs4.Fields(0) *should* generate the same error. I just tried it
out on one of my tables and it does just that. This is the case *even with*
DoCmd.SetWarnings False
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 3:13 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Last Record Problem
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
--
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