Group:  Microsoft Access » microsoft.public.access.formscoding
Thread: how to identify if last record?

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

how to identify if last record?
"krzysztof via AccessMonster.com" <u11875[ at ]uwe> 08.09.2006 13:07:20
Good Day!

i need a little help. i want to identify that the record that i am viewing
on my form is the last record. i maybe not had enough joe this morning, but
i cannot get this. any thoughts? any help is much appreciated.

~K

--
KMJ >!

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200609/1

Re: how to identify if last record?
"Jeff Boyce" <nonsense[ at ]nonsense.com> 08.09.2006 14:53:39
Define "last".

Now ask yourself, "does Access have the same definition that I do?"
Probably not!

Access tables are "buckets o' data", with no particular order to them.
"Last" implies something that's being used to order the records. What are
you using?

Regards

Jeff Boyce
Microsoft Office/Access MVP


"krzysztof via AccessMonster.com" <u11875[ at ]uwe> wrote in message
news:65fc1ee0eaec3[ at ]uwe...
[Quoted Text]
> Good Day!
>
> i need a little help. i want to identify that the record that i am
> viewing
> on my form is the last record. i maybe not had enough joe this morning,
> but
> i cannot get this. any thoughts? any help is much appreciated.
>
> ~K
>
> --
> KMJ >!
>
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200609/1
>


Re: how to identify if last record?
"David PONDA" <david_ponda[ at ]msn.com> 08.09.2006 14:58:07
use...

Dim Dummy as String
Dim db As Database
Dim Enr As Recordset
Set db = CurrentDb
Set Enr = db.OpenRecordset("YourTable", dbOpenDynaset)

Enr.MoveLast
Dummy = Enr!AnyFeld (here any field you want in your table as the last
record)

"krzysztof via AccessMonster.com" <u11875[ at ]uwe> a écrit dans le message de
news: 65fc1ee0eaec3[ at ]uwe...
[Quoted Text]
> Good Day!
>
> i need a little help. i want to identify that the record that i am
> viewing
> on my form is the last record. i maybe not had enough joe this morning,
> but
> i cannot get this. any thoughts? any help is much appreciated.
>
> ~K
>
> --
> KMJ >!
>
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200609/1
>


Re: how to identify if last record?
"krzysztof via AccessMonster.com" <u11875[ at ]uwe> 11.09.2006 12:13:01
Jeff,
Thanks for your reply. Usually in access, when you are click through
the records in a form and you reach the last one, you get a message "Cannot
go to the specified record'. the button is attached to the 'acNext' command.
There is no 'next' field for Access to go to, hence the error. You are right,
Access does have a different definition than I do! How can I identify that
there is not a 'Next' field available, so I do not prompt this error message?
My table is contsant - with only daily updates inported from another system.
This was the way it was specified to be designed. Any help is much
appreciated.

another note: How does one achieve this title of 'MS Access MVP'?

Jeff Boyce wrote:
[Quoted Text]
>Define "last".
>
>Now ask yourself, "does Access have the same definition that I do?"
>Probably not!
>
>Access tables are "buckets o' data", with no particular order to them.
>"Last" implies something that's being used to order the records. What are
>you using?
>
>Regards
>
>Jeff Boyce
>Microsoft Office/Access MVP
>
>> Good Day!
>>
>[quoted text clipped - 5 lines]
>>
>>

--
KMJ >!

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200609/1

Re: how to identify if last record?
"Jeff Boyce" <nonsense[ at ]nonsense.com> 11.09.2006 16:19:22
I'm a bit confused between "field" and "record" in your description.

Once again, though, the "last" record depends on how your records are
sorted.

Let's take a different appraoch -- why? What is it that you want to do with
knowledge about the "last" record?

If, as you mentioned, you don't want a "no next record" error message, you
could add error handling to your code behind the form and bypass (or offer
an alternative to) the error message.

The folks at Microsoft note support (user groups, publications, newsgroup
responses, etc.). Check the MVP website:
http://mvp.support.microsoft.com/

Regards

Jeff Boyce
Microsoft Office/Access MVP


"krzysztof via AccessMonster.com" <u11875[ at ]uwe> wrote in message
news:66215d407215b[ at ]uwe...
[Quoted Text]
> Jeff,
> Thanks for your reply. Usually in access, when you are click through
> the records in a form and you reach the last one, you get a message
> "Cannot
> go to the specified record'. the button is attached to the 'acNext'
> command.
> There is no 'next' field for Access to go to, hence the error. You are
> right,
> Access does have a different definition than I do! How can I identify
> that
> there is not a 'Next' field available, so I do not prompt this error
> message?
> My table is contsant - with only daily updates inported from another
> system.
> This was the way it was specified to be designed. Any help is much
> appreciated.
>
> another note: How does one achieve this title of 'MS Access MVP'?
>
> Jeff Boyce wrote:
>>Define "last".
>>
>>Now ask yourself, "does Access have the same definition that I do?"
>>Probably not!
>>
>>Access tables are "buckets o' data", with no particular order to them.
>>"Last" implies something that's being used to order the records. What are
>>you using?
>>
>>Regards
>>
>>Jeff Boyce
>>Microsoft Office/Access MVP
>>
>>> Good Day!
>>>
>>[quoted text clipped - 5 lines]
>>>
>>>
>
> --
> KMJ >!
>
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200609/1
>


Re: how to identify if last record?
"David PONDA" <david_ponda[ at ]msn.com> 12.09.2006 09:50:09
Ahhh ok in that case, the better way is to catch the Err.Number and test it,
if there is that one about the last number, juste Resume Next or let display
another message more than the standard one.
ok in code you mean to :

Private Sub Commande0_Click()
On Error GoTo Err_Commande0_Click


DoCmd.GoToRecord , , acNext

Exit_Commande0_Click:
Exit Sub

Err_Commande0_Click:
If Err.Number = 2499 Then '**** Where 2499 is the number
contains error (no more record....) ****
Resume Exit_Commande0_Click
Exit Sub
Else
MsgBox Err.Description
End If

"krzysztof via AccessMonster.com" <u11875[ at ]uwe> a écrit dans le message de
news: 66215d407215b[ at ]uwe...
[Quoted Text]
> Jeff,
> Thanks for your reply. Usually in access, when you are click through
> the records in a form and you reach the last one, you get a message
> "Cannot
> go to the specified record'. the button is attached to the 'acNext'
> command.
> There is no 'next' field for Access to go to, hence the error. You are
> right,
> Access does have a different definition than I do! How can I identify
> that
> there is not a 'Next' field available, so I do not prompt this error
> message?
> My table is contsant - with only daily updates inported from another
> system.
> This was the way it was specified to be designed. Any help is much
> appreciated.
>
> another note: How does one achieve this title of 'MS Access MVP'?
>
> Jeff Boyce wrote:
>>Define "last".
>>
>>Now ask yourself, "does Access have the same definition that I do?"
>>Probably not!
>>
>>Access tables are "buckets o' data", with no particular order to them.
>>"Last" implies something that's being used to order the records. What are
>>you using?
>>
>>Regards
>>
>>Jeff Boyce
>>Microsoft Office/Access MVP
>>
>>> Good Day!
>>>
>>[quoted text clipped - 5 lines]
>>>
>>>
>
> --
> KMJ >!
>
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200609/1
>


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