Previous, Next Record buttons not working on Form with required fields

  • Thread starter Antone via AccessMonster.com
  • Start date
A

Antone via AccessMonster.com

On my Form, I have some fields that are required fields. Since, I changed to
required fields my previous, next, first, and last record buttons are not
working. In design view, I dragged these buttons from the menu bar (Command
Button).

I think it's a simple change in property values or coding.

Can anyone help me? I try browsing on Threads, but I could not find this
problem.

Thanks so much in advance!

Tony
 
J

John W. Vinson

On my Form, I have some fields that are required fields. Since, I changed to
required fields my previous, next, first, and last record buttons are not
working. In design view, I dragged these buttons from the menu bar (Command
Button).

I think it's a simple change in property values or coding.

Can anyone help me? I try browsing on Threads, but I could not find this
problem.

Thanks so much in advance!

Tony

What is "not working"? What happens when you click the button? If you open
the form in design view and view the button's Properties, what's in the Click
event on the Events tab?
 
A

Antone via AccessMonster.com

John,

When I complete entering record & save that record. Then, I use previous
record button or first record button....and nothing happens.

This is what's on OnClick event for previous record:

Private Sub PreviousRecord_Click()

End Sub

This is what's on OnClick event for first record:


Private Sub FirstRecord_Click()

End Sub


I just dragged those buttons from main menu. They were working fine until I
changed some field to required field, or validation rule "Is not Null". I
tried to enter new command buttons....and the same thing happen....the
command buttons do nothing.

Thanks so much for your assistance,

Tony





On my Form, I have some fields that are required fields. Since, I changed to
required fields my previous, next, first, and last record buttons are not
[quoted text clipped - 9 lines]

What is "not working"? What happens when you click the button? If you open
the form in design view and view the button's Properties, what's in the Click
event on the Events tab?
 
J

John W. Vinson

John,

When I complete entering record & save that record. Then, I use previous
record button or first record button....and nothing happens.

This is what's on OnClick event for previous record:

Private Sub PreviousRecord_Click()

End Sub

This is what's on OnClick event for first record:


Private Sub FirstRecord_Click()

End Sub


I just dragged those buttons from main menu. They were working fine until I
changed some field to required field, or validation rule "Is not Null". I
tried to enter new command buttons....and the same thing happen....the
command buttons do nothing.

Well... they're doing exactly what you're telling them to do: nothing! Look at
the code - your PreviousRecord code consists of an End Sub, so when you click
the button it... does nothing, and exit the subroutine.

My guess is that you copied the buttons without copying the code that
originally went with the buttons, or the code never existed in the first
place.

Put a line in the PreviousRecord code

DoCmd.GoToRecord,,,acPrevious

and in the FirstRecord

DoCmd.GoToRecord,,,acFirst

and similarly for the other buttons - use intellisense in the code editor to
see the choices.
 
A

Antone via AccessMonster.com

Dear John,

I put in this following code (same format for all Previous, Next, First, &
Last):


Private Sub LastRecord_Click()
DoCmd.GoToRecord , , , acLast
End Sub

It still does nothing. I am missing something in the coding?

Thanks,

Tony



[quoted text clipped - 17 lines]
tried to enter new command buttons....and the same thing happen....the
command buttons do nothing.

Well... they're doing exactly what you're telling them to do: nothing! Look at
the code - your PreviousRecord code consists of an End Sub, so when you click
the button it... does nothing, and exit the subroutine.

My guess is that you copied the buttons without copying the code that
originally went with the buttons, or the code never existed in the first
place.

Put a line in the PreviousRecord code

DoCmd.GoToRecord,,,acPrevious

and in the FirstRecord

DoCmd.GoToRecord,,,acFirst

and similarly for the other buttons - use intellisense in the code editor to
see the choices.
 
L

Linq Adams via AccessMonster.com

Are you, perchance, using Access 2007? Code does not run in 2007 unless your
database resides in a folder that has been declared a “trusted†location.

To trust your folder, click:

Office Button (top left)
Access Options (bottom of dialog)
Trust Center (left)
Trust Center Settings (button)
Trusted Locations (left)
Add new location (button)

Dear John,

I put in this following code (same format for all Previous, Next, First, &
Last):

Private Sub LastRecord_Click()
DoCmd.GoToRecord , , , acLast
End Sub

It still does nothing. I am missing something in the coding?

Thanks,

Tony
[quoted text clipped - 20 lines]
and similarly for the other buttons - use intellisense in the code editor to
see the choices.
 
A

Antone via AccessMonster.com

Linq,

I am using Microsoft Access 2002. I think what happened is I change the
names of these Command button in Event. Thus, it erased my coding. Here is
my coding of previous version a few days ago...when the buttons were working.
But, the coding is not working....I think it's because I made some of my
fields Validation "Is not Null"......I might need to tweak the coding a
little bit. Thanks for all your help!

Private Sub FirstRecord_Click()
On Error GoTo Err_FirstRecord_Click

DoCmd.GoToRecord , , acFirst

Exit_FirstRecord_Click:
Exit Sub

Err_FirstRecord_Click:
MsgBox Err.Description
Resume Exit_FirstRecord_Click
End Sub







Linq said:
Are you, perchance, using Access 2007? Code does not run in 2007 unless your
database resides in a folder that has been declared a “trusted†location.

To trust your folder, click:

Office Button (top left)
Access Options (bottom of dialog)
Trust Center (left)
Trust Center Settings (button)
Trusted Locations (left)
Add new location (button)
Dear John,
[quoted text clipped - 16 lines]
 
J

John W. Vinson

I am using Microsoft Access 2002. I think what happened is I change the
names of these Command button in Event. Thus, it erased my coding. Here is
my coding of previous version a few days ago...when the buttons were working.
But, the coding is not working....I think it's because I made some of my
fields Validation "Is not Null"......I might need to tweak the coding a
little bit. Thanks for all your help!

Private Sub FirstRecord_Click()
On Error GoTo Err_FirstRecord_Click

DoCmd.GoToRecord , , acFirst

Exit_FirstRecord_Click:
Exit Sub

Err_FirstRecord_Click:
MsgBox Err.Description
Resume Exit_FirstRecord_Click
End Sub

I don't see how a validation rule on a field could have any effect on this
whatsoever; but certainly if the name of the button is something other than
FirstRecord, this code will NOT be called!

What is the actual Name property of the command button? It should match the
name of your Sub.
What is visible in its Click property in the design window? It should be
[Event Procedure].
 
A

Antone via AccessMonster.com

Ling,

Ok, they are semi-working with this coding....but, the only problem it goes
back to what I entered today. If there is any other data from yesterday...it
won't go back to edit records from prior to today.

IThis is very stange. Thanks so much!


Private Sub FirstRecord_Click()
On Error GoTo Err_FirstRecord_Click

DoCmd.GoToRecord , , acFirst

Exit_FirstRecord_Click:
Exit Sub

Err_FirstRecord_Click:
MsgBox Err.Description
Resume Exit_FirstRecord_Click
End Sub


Linq,

I am using Microsoft Access 2002. I think what happened is I change the
names of these Command button in Event. Thus, it erased my coding. Here is
my coding of previous version a few days ago...when the buttons were working.
But, the coding is not working....I think it's because I made some of my
fields Validation "Is not Null"......I might need to tweak the coding a
little bit. Thanks for all your help!

Private Sub FirstRecord_Click()
On Error GoTo Err_FirstRecord_Click

DoCmd.GoToRecord , , acFirst

Exit_FirstRecord_Click:
Exit Sub

Err_FirstRecord_Click:
MsgBox Err.Description
Resume Exit_FirstRecord_Click
End Sub
Are you, perchance, using Access 2007? Code does not run in 2007 unless your
database resides in a folder that has been declared a “trusted†location.
[quoted text clipped - 13 lines]
 
A

Antone via AccessMonster.com

John,

Now, the problem Previous Next only work with data entry in the current batch.


If I leave database to come enter more records....I can't go back to records
prior batch sessions to the current batch.

I don't know how all the codings for command buttons were erased. I went to
previously save version of database to copy the coding in Events.

Thanks for your patience as this is my first time to program Acess Database!

Thanks


Ling,

Ok, they are semi-working with this coding....but, the only problem it goes
back to what I entered today. If there is any other data from yesterday...it
won't go back to edit records from prior to today.

IThis is very stange. Thanks so much!

Private Sub FirstRecord_Click()
On Error GoTo Err_FirstRecord_Click

DoCmd.GoToRecord , , acFirst

Exit_FirstRecord_Click:
Exit Sub

Err_FirstRecord_Click:
MsgBox Err.Description
Resume Exit_FirstRecord_Click
End Sub
[quoted text clipped - 23 lines]
 
J

John W. Vinson

Now, the problem Previous Next only work with data entry in the current batch.


If I leave database to come enter more records....I can't go back to records
prior batch sessions to the current batch.

Sounds like you have the Form's "Data Entry" property set to Yes. It should be
No; if it's Yes, the only records visible on the form are those entered since
the form was last opened.
I don't know how all the codings for command buttons were erased. I went to
previously save version of database to copy the coding in Events.

Glad you were prudent enough to keep a backup!!
Thanks for your patience as this is my first time to program Acess Database!

We're here to help!
 
A

Antone via AccessMonster.com

John,

Yep, you were right! DataEntry was set to "YES".

All works great now!!! Thanks so much for your time your spent guiding me
through problem. I am new at Access...but, I am learning fast.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top