Hi, I have created a form that will be used to enter information into a table. The form is set up so that it pulls up only the blanc "new record" line from the table that way the user sees an empty form. Unfortunately once you start entering data the new record navigation button gets enabled and if you scroll down using the mouse wheel you end up on another new blanc record.
I don't want people to accidentally move onto record 2, they will never need to enter more than one record.
I tried to set the Allow Additions property to 'No', but when I do that I can't see my form anymore.
Is there any way to prevent the addition of a new record once you start entering data?
10 18893
In the form properties remove the Navigation buttons.
Mary
Thanks. I tried your solution, but it doesn't resolve my problem completely. When the users scroll down (the form is too long) and they use the mouse wheel they automatically see the new record, regardless if there are navigation buttons or not.
Is there anything that can be done to prevent the automatic addition of a new record?
Thanks again.
Thanks. I tried your solution, but it doesn't resolve my problem completely. When the users scroll down (the form is too long) and they use the mouse wheel they automatically see the new record, regardless if there are navigation buttons or not.
Is there anything that can be done to prevent the automatic addition of a new record?
Thanks again.
Is this a continuous form?
Is this a continuous form?
If it is change it to single form view. Now to turn off the mouse wheel have a look at Stephen Lebans MouseWheel on/off solution.
Mary
NeoPa 32,556
Expert Mod 16PB
Thanks. I tried your solution, but it doesn't resolve my problem completely. When the users scroll down (the form is too long) and they use the mouse wheel they automatically see the new record, regardless if there are navigation buttons or not.
Is there anything that can be done to prevent the automatic addition of a new record?
Thanks again.
Create a - Private Form_BeforeUpdate(Cancel As Integer)
event procedure which checks that all the data has been entered correctly and, if it has not, sets Cancel = True.
Hi, I have created a form that will be used to enter information into a table. The form is set up so that it pulls up only the blanc "new record" line from the table that way the user sees an empty form. Unfortunately once you start entering data the new record navigation button gets enabled and if you scroll down using the mouse wheel you end up on another new blanc record.
I don't want people to accidentally move onto record 2, they will never need to enter more than one record.
I tried to set the Allow Additions property to 'No', but when I do that I can't see my form anymore.
Is there any way to prevent the addition of a new record once you start entering data?
If all your Data has been entered correctly via NeoPa's approach, and the User 'never' has to enter more than 1 New Record, you can place a DoCmd.Close in the AfterUpdate() Event of your Form. This is a little unorthodox, and not exactly good Database practice, but it will accomplish what you are looking for, I think. To recap all that has been said: __1. Form should be in Single Form __2. Disable Navigation Buttons __3. Thorough Validation Code in the BeforeUpdate() Event __4. Data Entry = True __5. DoCmd.Close in the AfterUpdate() Event of the Form
Hi all,
I'm also having the same problem with trying to prevent the addition of new records. My sub form needs to be able to add a record if none exists for the given id. But if one already exists, it shouldnt be able to create another.
My form is set to single form, I have disabled the nav buttons, and I have the mousewheelonoff script installed and working. The problem is that even with all that disabled, i can still hit the tab button, cycle through all the fields in view and then it will move to the new record.
Is there a way I could prevent the addition when one record already exists? Perhaps in the form_load code, but I'm not sure how to check if a record exists or not.
thanks for any help.
...The problem is that even with all that disabled, i can still hit the tab button, cycle through all the fields in view and then it will move to the new record.
Set the Cycle property of the form to 'Current Record'. The tab key will then only cycle among the fields on the current record. Hope this helps.
Set the Cycle property of the form to 'Current Record'. The tab key will then only cycle among the fields on the current record. Hope this helps.
Thanks for the tip.
However, I already found another way around the issue. I'll post my solution for anyone else who might be interested. And to get feedback in case it's flawed in some way (it seems to work great though)
First, I created a textbox on the form and gave it the following properties: - name: txtCount
-
visible: no
-
control source: =Count(*)
Next, I added this line to the Form_Load event. - Me.AllowAdditions = AllowNewRecords()
Finally, I created the AllowNewRecords() function - Function AllowNewRecords() As Boolean
-
On Error GoTo Err_AllowNewRecords
-
-
If txtCount.Value > 0 Then
-
AllowNewRecords = False
-
Else
-
AllowNewRecords = True
-
End If
-
-
Exit_AllowNewRecords:
-
Exit Function
-
-
Err_AllowNewRecords:
-
AllowNewRecords = True
-
Resume Exit_AllowNewRecords
-
-
End Function
Essentially, the way it works is that if there is a record already, then txtcount equals one and the function sets AllowAdditions to false. If there isnt any records, then the txtcount has no value and generates an error saying "You entered an expression that has no value", except I simply redirect the error to allow additions.
it's not perfect, but it works.
NeoPa 32,556
Expert Mod 16PB
Thank you for posting your solution.
It's always interesting to see solutions, even when found outside of TSDN.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Iain Miller |
last post by:
Struggling a bit here & would be grateful for any help.
I have a table which has a list of people in it. Each person has a unique ID
automatically allocated by Access but also belongs to one of 5...
|
by: Saintor |
last post by:
What I do now is I put a value in the tag property, and using the
form_current event, I run through all controls properties until the ones
with the required tag value are met. Sound OK in theory,...
|
by: edworboys |
last post by:
I have designed a data entry form with a number of fields and a sub
form. The first field (Country) is a combo box and the user selects a
country. This, in turn reduces the number of options in the...
|
by: Will |
last post by:
I have a form which has a field Start Date. I want to only let the user
enter a date if there is no date in the field and never be able to edit the
field. I have experimented with On Enter and On...
|
by: GGerard |
last post by:
Hello
I have an Access 2000 form with the following properties:
Record Source - Table1
|
by: Sinity |
last post by:
Anyone knows the method/codes to disable the clicked button after first
click by using .aspx-- to prevent people to click many time when waiting for
the server response.
I tried to do this by...
|
by: hippomedon |
last post by:
Hello everyone,
I'm looking for some advice on whether I should break the
normalization rule. Normally, I would not consider it, but this seems
to be a special case.
I have created an...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I disable the right mouse button?
-----------------------------------------------------------------------...
|
by: Bob Alston |
last post by:
Anyone know how to disable or redefine the Ctrl - hotkey which deletes a
record? I have a multi page form that uses 14 records, each record
handles 1-2 pages of the 18 page form. Occasionally ,...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |