[AccessD] Record Count Problem

Max Wanadoo max.wanadoo at gmail.com
Wed Feb 18 00:49:13 CST 2009


Hi Rocky,

>just like to write programs that don't create errors.
Don't think of them as "errors" but as "conditions".  When this "condition"
occurs, do this.

I also use the rs.goto lastmodified to position on the record just added
Would you like me to post the code I use when adding records in code (not
SQL, straight VBA)?

Max


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: 17 February 2009 14:57
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Record Count Problem

I could do the move last but that would mean a bit of On Error GoTo, check
for the right error code, Resume Label:, etc.  

I've used error traps before to trap errors which are deliberately
generated, but as an old fashioned programmer it always rubbed me the wrong
way.  Nothing wrong with it, of course, just like to write programs that
don't create errors.


Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com
www.bchacc.com
 
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of William Hindman
Sent: Tuesday, February 17, 2009 6:42 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Record Count Problem

...I understand that Max ...the question is, without the movelast, what is a
stand-alone recordcount actually counting ...does recordcount return a 1 or
zero if a record has not been accessed ...I always go to the last record so
I can't say yes or no ...but if records are there but have not been accessed
as yet, will recordcount return a zero value?

William

--------------------------------------------------
From: "Max Wanadoo" <max.wanadoo at gmail.com>
Sent: Tuesday, February 17, 2009 3:49 AM
To: "'Access Developers discussion and problem solving'" 
<accessd at databaseadvisors.com>
Subject: Re: [AccessD] Record Count Problem

> Hi William,
>
> I *think* that Rocky just needs to know if there are ANY records at all.
>
> He is not interested in how many there are, just whether there is none 
> or some.  For his own reasons he said he does not want to requery the 
> recordset to use the recordsetclone and therefore the rs.recordcount 
> will work just fine whereas the rs.eof and rs.bof will not.
>
> Personally, I would have requeried if I was using a recordsetclone 
> having saved the record pointer and then repositioned on the pointer.  
> Rocky did not want to do that.
>
> Max
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of William 
> Hindman
> Sent: 17 February 2009 01:51
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Record Count Problem
>
> ...hhhmmm ...iirc (and that gets more hypothetical with every year) 
> the rs.recordcount will return a count of records "accessed" ...not 
> the total count of records in the object ...you have to do a movelast 
> before the rs.recordcount to be sure what its actually counting.
>
> William
>
> --------------------------------------------------
> From: "Rocky Smolin at Beach Access Software" <rockysmolin at bchacc.com>
> Sent: Monday, February 16, 2009 3:58 PM
> To: "'Access Developers discussion and problem solving'"
> <accessd at databaseadvisors.com>
> Subject: Re: [AccessD] Record Count Problem
>
>> I changed
>>
>> If rs.BOF = True And rs.EOF = True Then
>>
>> To
>>
>> If rs.RecordCount = 0 Then
>>
>> Crude but effective.
>>
>>
>>
>> Rocky Smolin
>> Beach Access Software
>> 858-259-4334
>> www.e-z-mrp.com
>> www.bchacc.com
>>
>>
>>
>> -----Original Message-----
>> From: accessd-bounces at databaseadvisors.com
>> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max 
>> Wanadoo
>> Sent: Monday, February 16, 2009 12:18 PM
>> To: 'Access Developers discussion and problem solving'
>> Subject: Re: [AccessD] Record Count Problem
>>
>> If rs.BOF = True And rs.EOF = True and rs.recordcount = 0 Then GoTo 
>> GoodBye Else Goto WaveHelloToRocky End if
>>
>>
>> Or save the PK, then requery, then find saved PK and position on it.
>>
>>
>> Max
>>
>>
>>
>> -----Original Message-----
>> From: accessd-bounces at databaseadvisors.com
>> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky 
>> Smolin at Beach Access Software
>> Sent: 16 February 2009 19:09
>> To: 'Access Developers discussion and problem solving'
>> Subject: [AccessD] Record Count Problem
>>
>> Dear List:
>>
>> In the following:
>>
>> Set rs = Me.RecordsetClone
>> ' If no records then goodbye:
>> MsgBox rs.RecordCount
>> If rs.BOF = True And rs.EOF = True Then GoTo GoodBye:
>>
>> the record count shows as 1 but BOF and EOF are both true.
>>
>> The record was just added.  So the routine exits instead of doing 
>> what it's supposed to do.
>>
>> A Me.Requery solves the problem, but leaves the pointer at the start 
>> of the the recordset instead of the record the user was working on.
>>
>> I can's save a bookmark because the Requery triggers the activate 
>> event which calls this routine and destroys the bookmark.
>>
>> But why would the record count show 1 when the BOf and EOF are set to 
>> True?
>>
>> TIA
>>
>>
>>
>>
>>
>>
>> Rocky Smolin
>>
>> Beach Access Software
>>
>> 858-259-4334
>>
>> www.e-z-mrp.com <http://www.e-z-mrp.com/>
>>
>> www.bchacc.com <http://www.bchacc.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
>>
>
> --
> 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




More information about the AccessD mailing list