Connecting Tech Pros Worldwide Forums | Help | Site Map

Form Record Navigation

fred14214
Guest
 
Posts: n/a
#1: Nov 12 '05
Dear Group:

I have built and customized a form using the wizard to put command
buttons that will move to the NEXT record or PREVIOUS record. This
works, but it needs some refinement.

Presently, if I am on the first record and click the PREVIOUS record
button, I get some built in, generic Access message. And, if I am on
the last record from the table and I click the NEXT record button, I
am advanced to the *new* record row in the table.

What I would like to happen- if I am on the first record and click
PREVIOUS, I would like Access to give my own message such as *This is
the first record*. Or, if I am on the last record and click NEXT, I
don't want the form to read the blank row- rather I want Access to
fire a message that *This is the last record*.

I am not that fluent with VBA, can someone please give me a hand?
Thanks.

(version- Access 2002)

fredg@example.invalid
Guest
 
Posts: n/a
#2: Nov 12 '05

re: Form Record Navigation


On 10 Jan 2004 11:53:27 -0800, fred14214@yahoo.com (fred14214) wrote:
[color=blue]
>Dear Group:
>
>I have built and customized a form using the wizard to put command
>buttons that will move to the NEXT record or PREVIOUS record. This
>works, but it needs some refinement.
>
>Presently, if I am on the first record and click the PREVIOUS record
>button, I get some built in, generic Access message. And, if I am on
>the last record from the table and I click the NEXT record button, I
>am advanced to the *new* record row in the table.
>
>What I would like to happen- if I am on the first record and click
>PREVIOUS, I would like Access to give my own message such as *This is
>the first record*. Or, if I am on the last record and click NEXT, I
>don't want the form to read the blank row- rather I want Access to
>fire a message that *This is the last record*.
>
>I am not that fluent with VBA, can someone please give me a hand?
>Thanks.
>
>(version- Access 2002)[/color]

How about just disabling each of the command buttons as needed:

In the Form's Current event:

CmdPreviousRecord.Enabled = Not Me.CurrentRecord = 1
CmdNextRecord.Enabled = Not Me.CurrentRecord =
Me.RecordsetClone.RecordCount

No need to show a message or click OK to go on.

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
fred14214
Guest
 
Posts: n/a
#3: Nov 12 '05

re: Form Record Navigation


Hi: Thanks for your time and input. I have done exactly as you said
(except for substituting in my names for the command buttons) and this
is the result.

When I open the form by double clicking its name from the Forms
window, both buttons are disabled.

If I open the form in Design View and then click the View button, then
sometimes the NEXT button is in an Enabled state.

How can I fix this?

Thanks.

fredg@example.invalid wrote in message news:<ofo000dv0l33b4g69qa9br9mmna006h8n2@4ax.com>. ..[color=blue]
> On 10 Jan 2004 11:53:27 -0800, fred14214@yahoo.com (fred14214) wrote:
>[color=green]
> >Dear Group:
> >
> >I have built and customized a form using the wizard to put command
> >buttons that will move to the NEXT record or PREVIOUS record. This
> >works, but it needs some refinement.
> >
> >Presently, if I am on the first record and click the PREVIOUS record
> >button, I get some built in, generic Access message. And, if I am on
> >the last record from the table and I click the NEXT record button, I
> >am advanced to the *new* record row in the table.
> >
> >What I would like to happen- if I am on the first record and click
> >PREVIOUS, I would like Access to give my own message such as *This is
> >the first record*. Or, if I am on the last record and click NEXT, I
> >don't want the form to read the blank row- rather I want Access to
> >fire a message that *This is the last record*.
> >
> >I am not that fluent with VBA, can someone please give me a hand?
> >Thanks.
> >
> >(version- Access 2002)[/color]
>
> How about just disabling each of the command buttons as needed:
>
> In the Form's Current event:
>
> CmdPreviousRecord.Enabled = Not Me.CurrentRecord = 1
> CmdNextRecord.Enabled = Not Me.CurrentRecord =
> Me.RecordsetClone.RecordCount
>
> No need to show a message or click OK to go on.[/color]
fredg@example.invalid
Guest
 
Posts: n/a
#4: Nov 12 '05

re: Form Record Navigation


On 11 Jan 2004 09:05:01 -0800, eomermuil@yahoo.com (fred14214) wrote:
[color=blue]
>Hi: Thanks for your time and input. I have done exactly as you said
>(except for substituting in my names for the command buttons) and this
>is the result.
>
>When I open the form by double clicking its name from the Forms
>window, both buttons are disabled.
>
>If I open the form in Design View and then click the View button, then
>sometimes the NEXT button is in an Enabled state.
>
>How can I fix this?
>
>Thanks.
>
>fredg@example.invalid wrote in message news:<ofo000dv0l33b4g69qa9br9mmna006h8n2@4ax.com>. ..[color=green]
>> On 10 Jan 2004 11:53:27 -0800, fred14214@yahoo.com (fred14214) wrote:
>>[/color][/color]

Yup, you're right.

Change the code to the following:

CmdPreviousRecord.Enabled = Not Me.CurrentRecord = 1
CmdNextRecord.Enabled = Me.CurrentRecord = 1 Or Me.CurrentRecord <
Me.Recordset.RecordCount

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
Closed Thread