|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Turning off "editing" in forms last record.
Hi guys,
I'm in a picle here. I can't seem to fina any info on turnong turning off "editing" or is it, "adding new record" in my forms last record. Here is my case. In the code below, I have some calculations that add some numbers on my form and displays them during a Form's PgDn/Pgup so that the user can see at a glance, what values to react upon.. Code:
Private Sub Form_Current() ... code snips End Sub Becuase this code is in the _Current() area, and when the user is at the end of the record on the form, say for example, usre is on records 60 of 60. The user is usually not careful enough (inluding myself) and I or the users will make the mistake and continuing pressing the PgDn key (or holding it there) and before you know it, NEW blank records are added (lots of them) I need to know how to overcome this problem. Is there something that I can code or whatever, that will NOT add new records when there user is at the end of the last record on a given form ? Note, I've tried messing around with the: Cycle - All records; Current record; and Current page but that does not work for me, or it completely DISABLES my ability to add a new record, even if I press my Ctrl_+ key add a new record. If I can turn it on/off at will through code, when at the right moment in the form, I would really appeciate it. Thanks for any assistance on this. EDIT: - I forgot to mention, that at every record a user is on, that ../ (<--- is a pencil) is always displayed in the top left corner. But, this is only when I have code in the _Current() sectoin. -myaccess Last edited by myaccess : December 10th, 2003 at 09:03 PM. |
|
#2
|
||||
|
||||
|
When you load the form, you can capture the number of records in the underlying table/query by reading the form's Recordset.RecordCount property, and in the same time, you can capture the current record number by reading the form's Recordset.AbsolutePosition property.
AbsolutePosition is indexed from 0 so when you're on the first record, then the AbsolutePosition is 0. When you're on the last record, the AbsolutePosition equals to RecordCount-1. So it tells you where you are in the Recordset. Play around with these properties to enable or disable adding records by using the form's AllowAdditions property in the form's OnCurrent event handler. If the form is a single form (i.e. shows a single record at a time) Cycle property is recommended to be set to Current Record.
__________________
BRegs, TBÁrpi "I can only show you the door. You're the one who has to walk through it." |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Turning off "editing" in forms last record. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|