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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Stop at last record



 
 
Thread Tools Display Modes
  #1  
Old January 17th, 2005, 08:13 PM
New TO Access
external usenet poster
 
Posts: n/a
Default Stop at last record

I have a form that uses navigation buttons for the user to view all the
records. When they reach the last record and select next a blank record
appears. As I have some calculations that occur when the form loads this
results in the auto-number generating a new record in the table. If the user
didn't want to create a new record and leave the form I am left with a
redundant record in the table.

I have another button which utilises carry over code for new records so I
want the user to only use that for new records.

How do I force at "stop" at the last record?
  #2  
Old January 17th, 2005, 08:51 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

"New TO Access" wrote in
message
I have a form that uses navigation buttons for the user to view all
the records. When they reach the last record and select next a blank
record appears. As I have some calculations that occur when the form
loads this results in the auto-number generating a new record in the
table. If the user didn't want to create a new record and leave the
form I am left with a redundant record in the table.

I have another button which utilises carry over code for new records
so I want the user to only use that for new records.

How do I force at "stop" at the last record?


If you set the form's AllowAdditions property to No, the user won't be
able to navigate to a new record. If your navigation buttons are not
the builtin ones, you may have to modify the code behind the "next
record" button to trap and ignore an error that may be raised when the
code tries to go to the next record. Naturallky, since I can't see the
code, I can't tell you exactly what changes you may have to make. An
alternative is to have code in the form's Current event to disable or
enable the "next record" button depending on whether you are on the last
record or not.

Your "new record" button may need to temporarily set the AllowAdditions
property to Yes before you go to the new record, in which case you'll
need code in some event -- maybe the form's AfterInsert event -- to set
it back to No again.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


  #3  
Old January 17th, 2005, 09:54 PM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Mon, 17 Jan 2005 12:13:01 -0800, "New TO Access"
wrote:

How do I force at "stop" at the last record?


Set the Form's AllowAdditions property to No. If you want to add
records, you can change this property when needed, or add the record
to the table in code.

John W. Vinson[MVP]
  #4  
Old January 18th, 2005, 12:43 AM
New TO Access
external usenet poster
 
Posts: n/a
Default

Thanks folks. The allow additions worked really well!

"John Vinson" wrote:

On Mon, 17 Jan 2005 12:13:01 -0800, "New TO Access"
wrote:

How do I force at "stop" at the last record?


Set the Form's AllowAdditions property to No. If you want to add
records, you can change this property when needed, or add the record
to the table in code.

John W. Vinson[MVP]

  #5  
Old August 25th, 2005, 03:52 PM
paulpenta
external usenet poster
 
Posts: n/a
Default

I have faced the same problem and got the fix here (from you, I think). It
worked as advertises, but now does not. What could I have done to mess this
up?

Thanks

"John Vinson" wrote:

On Mon, 17 Jan 2005 12:13:01 -0800, "New TO Access"
wrote:

How do I force at "stop" at the last record?


Set the Form's AllowAdditions property to No. If you want to add
records, you can change this property when needed, or add the record
to the table in code.

John W. Vinson[MVP]

 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent Blank Records being written. Need Help. Robert Nusz @ DPS Using Forms 4 December 29th, 2004 05:15 PM
Automatically displaying a certain record of a query General Discussion 1 December 12th, 2004 10:08 PM
How to get a field on a form to reflect a certain record of a query? General Discussion 0 December 11th, 2004 12:56 AM
Stop page breaks within a record. Marc Mailmerge 0 September 24th, 2004 02:52 PM
Form Does Not Go To New Record Steve New Users 1 May 12th, 2004 03:15 AM


All times are GMT +1. The time now is 04:04 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.