A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Go To Next Record



 
 
Thread Tools Display Modes
  #1  
Old February 2nd, 2009, 01:49 AM posted to microsoft.public.access.gettingstarted
Roger Bell
external usenet poster
 
Posts: 275
Default Go To Next Record

I have the following AfterUpdate Event procedure on a form that takes the
user to the next record, when an amount is entered and the Enter key pressed.
This field defaults to 0.00. Sometimes the amount does not need to be
changed. What I would like is if the amount remains as 0.00 and the Enter
key is pressed, the user is taken to the next record:

Private Sub W1_AfterUpdate()
On Error GoTo Err_Next_Envelope1_Click


DoCmd.GoToRecord , , acNext

Exit_Next_Envelope1_Click:
Me.W1.SetFocus
Exit Sub

Err_Next_Envelope1_Click:
MsgBox Err.Description
Resume Exit_Next_Envelope1_Click


DoCmd.RunCommand acCmdSaveRecord
End Sub

Any help would be appreciated
  #2  
Old February 2nd, 2009, 04:05 AM posted to microsoft.public.access.gettingstarted
AccessVandal via AccessMonster.com
external usenet poster
 
Posts: 461
Default Go To Next Record

You can try

If Me.W1 = 0 Then
DoCmd.GoToRecord , , acNext
end if

Roger Bell wrote:
I have the following AfterUpdate Event procedure on a form that takes the
user to the next record, when an amount is entered and the Enter key pressed.
This field defaults to 0.00. Sometimes the amount does not need to be
changed. What I would like is if the amount remains as 0.00 and the Enter
key is pressed, the user is taken to the next record:

Private Sub W1_AfterUpdate()
On Error GoTo Err_Next_Envelope1_Click

DoCmd.GoToRecord , , acNext

Exit_Next_Envelope1_Click:
Me.W1.SetFocus
Exit Sub

Err_Next_Envelope1_Click:
MsgBox Err.Description
Resume Exit_Next_Envelope1_Click


DoCmd.RunCommand acCmdSaveRecord
End Sub

Any help would be appreciated


--
Please Rate the posting if helps you.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...arted/200902/1

  #3  
Old February 2nd, 2009, 05:46 AM posted to microsoft.public.access.gettingstarted
Roger Bell
external usenet poster
 
Posts: 275
Default Go To Next Record

Thanks for that Accessvandal,

However, I do not want the user to skip the record if the value is 0.00, as
often they will need to enter a figure. If the figure stays as 0.00, and
they press Enter key to accept this, then they will be taken to the next
record.

Any other clues?

With Thanks

"AccessVandal via AccessMonster.com" wrote:

You can try

If Me.W1 = 0 Then
DoCmd.GoToRecord , , acNext
end if

Roger Bell wrote:
I have the following AfterUpdate Event procedure on a form that takes the
user to the next record, when an amount is entered and the Enter key pressed.
This field defaults to 0.00. Sometimes the amount does not need to be
changed. What I would like is if the amount remains as 0.00 and the Enter
key is pressed, the user is taken to the next record:

Private Sub W1_AfterUpdate()
On Error GoTo Err_Next_Envelope1_Click

DoCmd.GoToRecord , , acNext

Exit_Next_Envelope1_Click:
Me.W1.SetFocus
Exit Sub

Err_Next_Envelope1_Click:
MsgBox Err.Description
Resume Exit_Next_Envelope1_Click


DoCmd.RunCommand acCmdSaveRecord
End Sub

Any help would be appreciated


--
Please Rate the posting if helps you.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...arted/200902/1


  #4  
Old February 2nd, 2009, 09:29 AM posted to microsoft.public.access.gettingstarted
AccessVandal via AccessMonster.com
external usenet poster
 
Posts: 461
Default Go To Next Record

What about this

If Me.W1 0 Then
DoCmd.GoToRecord , , acNext
end if


Roger Bell wrote:
Thanks for that Accessvandal,

However, I do not want the user to skip the record if the value is 0.00, as
often they will need to enter a figure. If the figure stays as 0.00, and
they press Enter key to accept this, then they will be taken to the next
record.

Any other clues?

With Thanks

You can try

[quoted text clipped - 26 lines]

Any help would be appreciated


--
Please Rate the posting if helps you.

Message posted via http://www.accessmonster.com

  #5  
Old February 2nd, 2009, 09:50 AM posted to microsoft.public.access.gettingstarted
AccessVandal via AccessMonster.com
external usenet poster
 
Posts: 461
Default Go To Next Record

Sorry about that, but I'm not sure about what you meant.

It is also possible to use the form's beforeupdate event to validate the
control's value.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.W1 0 then
'move to next record if the control's value is 0
DoCmd.GoToRecord , , acNext
else
'do something
end if
End Sub

If you meant you want to trap the "enter key" on the keyboard on that control

Private Sub W1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 then 'if enter key is press down
DoCmd.GoToRecord , , acNext
else
'do something
end if
End Sub

Roger Bell wrote:
Thanks for that Accessvandal,

However, I do not want the user to skip the record if the value is 0.00, as
often they will need to enter a figure. If the figure stays as 0.00, and
they press Enter key to accept this, then they will be taken to the next
record.

Any other clues?

With Thanks


--
Please Rate the posting if helps you.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...arted/200902/1

  #6  
Old February 2nd, 2009, 09:54 AM posted to microsoft.public.access.gettingstarted
AccessVandal via AccessMonster.com
external usenet poster
 
Posts: 461
Default Go To Next Record

Edit:

If KeyCode = 13 and me.W1 = 0 Then 'if Enter key is press down and
control's value is 0

AccessVandal wrote:
Sorry about that, but I'm not sure about what you meant.

It is also possible to use the form's beforeupdate event to validate the
control's value.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.W1 0 then
'move to next record if the control's value is 0
DoCmd.GoToRecord , , acNext
else
'do something
end if
End Sub

If you meant you want to trap the "enter key" on the keyboard on that control

Private Sub W1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 then 'if enter key is press down
DoCmd.GoToRecord , , acNext
else
'do something
end if
End Sub

Thanks for that Accessvandal,

[quoted text clipped - 6 lines]

With Thanks



--
Please Rate the posting if helps you.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...arted/200902/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.