473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Checking That A Record Was Not previously Entered

Sue
As soon as a character is entered in the first field of a new record, the number
of records shown in the navigation buttons increases by 1 and the new record
button becomes enabled. In the BeforeUpdate event of the first field, I check to
see if that value has been previously entered. If it has, I do a Cancel = True
and a Me.Undo. The number of records does not change and the new record button
is still enabled although clicking it does nothing. This is confusing! The
indicated number of records is wrong and you can not go to a new record. Is
there another way of checking that a record was not previously entered than what
I am doing in the BeforeUpdate event?

Thanks!

Sue
Nov 12 '05 #1
5 3042
TC
I don't have Access here to check, but I believe that the cancel & me.undo
would just undo the value entered in that field. I don't think it will undo
the creation of an unsaved new record. So you are still positioned on a new
record, no?

Do you really want to automatically >discard< the unsaved (blank) new
record, when the value entered in that field is already on file? That's a
bit non-standard, IMO. Normally you would issue a message, cancel the
beforeupdate, but >not< Undo. Then the user can amend the value & try again,
or press Esc a few times to discard the unsaved new record.

HTH,
TC
"Sue" <sp*****@eartklink.net> wrote in message
news:S9*****************@newsread1.news.atl.earthl ink.net...
As soon as a character is entered in the first field of a new record, the number of records shown in the navigation buttons increases by 1 and the new record button becomes enabled. In the BeforeUpdate event of the first field, I check to see if that value has been previously entered. If it has, I do a Cancel = True and a Me.Undo. The number of records does not change and the new record button is still enabled although clicking it does nothing. This is confusing! The
indicated number of records is wrong and you can not go to a new record. Is there another way of checking that a record was not previously entered than what I am doing in the BeforeUpdate event?

Thanks!

Sue

Nov 12 '05 #2
Sue
TC,

Thanks for responding!

If you don't Undo and the user closes the form without pressing ESC a few times
then a blank record is saved.

Sue
"TC" <a@b.c.d> wrote in message news:1068952429.901715@teuthos...
I don't have Access here to check, but I believe that the cancel & me.undo
would just undo the value entered in that field. I don't think it will undo
the creation of an unsaved new record. So you are still positioned on a new
record, no?

Do you really want to automatically >discard< the unsaved (blank) new
record, when the value entered in that field is already on file? That's a
bit non-standard, IMO. Normally you would issue a message, cancel the
beforeupdate, but >not< Undo. Then the user can amend the value & try again,
or press Esc a few times to discard the unsaved new record.

HTH,
TC
"Sue" <sp*****@eartklink.net> wrote in message
news:S9*****************@newsread1.news.atl.earthl ink.net...
As soon as a character is entered in the first field of a new record, the

number
of records shown in the navigation buttons increases by 1 and the new

record
button becomes enabled. In the BeforeUpdate event of the first field, I

check to
see if that value has been previously entered. If it has, I do a Cancel =

True
and a Me.Undo. The number of records does not change and the new record

button
is still enabled although clicking it does nothing. This is confusing! The
indicated number of records is wrong and you can not go to a new record.

Is
there another way of checking that a record was not previously entered

than what
I am doing in the BeforeUpdate event?

Thanks!

Sue


Nov 12 '05 #3
TC
Sue, there's no way you can save an all-blank record. It simply does not
happen. I think that what you are seeing, is a well-known Access bug. If you
close a form by clicking the close button at the top right corner, Access
tres to save the pending new or edited record - as it should do. But if it
can not< save that record for any reason - eg. a missing mandatory field - it discards the record >silently<, without a visible message of any kind. So
I think that what you are seeing is, the unsaved new record being discarded
silently - not saved.

Yes? No?

HTH,
TC
"Sue" <sp*****@eartklink.net> wrote in message
news:hj*****************@newsread1.news.atl.earthl ink.net... TC,

Thanks for responding!

If you don't Undo and the user closes the form without pressing ESC a few times then a blank record is saved.

Sue
"TC" <a@b.c.d> wrote in message news:1068952429.901715@teuthos...
I don't have Access here to check, but I believe that the cancel & me.undo would just undo the value entered in that field. I don't think it will undo the creation of an unsaved new record. So you are still positioned on a new record, no?

Do you really want to automatically >discard< the unsaved (blank) new
record, when the value entered in that field is already on file? That's a bit non-standard, IMO. Normally you would issue a message, cancel the
beforeupdate, but >not< Undo. Then the user can amend the value & try again, or press Esc a few times to discard the unsaved new record.

HTH,
TC
"Sue" <sp*****@eartklink.net> wrote in message
news:S9*****************@newsread1.news.atl.earthl ink.net...
As soon as a character is entered in the first field of a new record, the
number
of records shown in the navigation buttons increases by 1 and the new

record
button becomes enabled. In the BeforeUpdate event of the first field,
I check to
see if that value has been previously entered. If it has, I do a
Cancel = True
and a Me.Undo. The number of records does not change and the new
record button
is still enabled although clicking it does nothing. This is confusing!
The indicated number of records is wrong and you can not go to a new

record. Is
there another way of checking that a record was not previously entered

than what
I am doing in the BeforeUpdate event?

Thanks!

Sue



Nov 12 '05 #4
Me.Requery should correct the count of records.

HTH
- Turtle

"Sue" <sp*****@eartklink.net> wrote in message
news:S9*****************@newsread1.news.atl.earthl ink.net...
As soon as a character is entered in the first field of a new record, the number of records shown in the navigation buttons increases by 1 and the new record button becomes enabled. In the BeforeUpdate event of the first field, I check to see if that value has been previously entered. If it has, I do a Cancel = True and a Me.Undo. The number of records does not change and the new record button is still enabled although clicking it does nothing. This is confusing! The
indicated number of records is wrong and you can not go to a new record. Is there another way of checking that a record was not previously entered than what I am doing in the BeforeUpdate event?

Thanks!

Sue

Nov 12 '05 #5
Even after the Me.Undo, you are still on the (blank) NewRec. You need to
make one of the existing Records the CurrentRecord of your Form.

Try moving to the last Record with:

DoCmd.GoToRecord , , acLast

after you set Cancel to True.

(tested OK in A2K)

--
HTH
Van T. Dinh
MVP (Access)

"Sue" <sp*****@eartklink.net> wrote in message
news:S9*****************@newsread1.news.atl.earthl ink.net...
As soon as a character is entered in the first field of a new record, the number of records shown in the navigation buttons increases by 1 and the new record button becomes enabled. In the BeforeUpdate event of the first field, I check to see if that value has been previously entered. If it has, I do a Cancel = True and a Me.Undo. The number of records does not change and the new record button is still enabled although clicking it does nothing. This is confusing! The
indicated number of records is wrong and you can not go to a new record. Is there another way of checking that a record was not previously entered than what I am doing in the BeforeUpdate event?

Thanks!

Sue

Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Keith | last post by:
I have a simple form where a user enters their email address, which then passed them to a 2nd page where the email address entered is used to filter a recordset. How can I set up an IF statement...
2
by: R Bolling | last post by:
I am using a routine to check to see if a phone number (PK) has alread been entered, and takes the user to that record if it is found -- as follows: Private Sub...
1
by: Richard Hollenbeck | last post by:
I'm getting errors. Access is telling me that it can't add a record. I have a table of college courses and a linked table of groups of activities in that course as a linked table (one course to...
15
by: Steve | last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I have code that sets the default value of each field to its current value. For a new record, I can put the focus in any...
6
by: John | last post by:
Hi We have a staff database and need to make sure that the same staff is not entered twice. Is there a way for Access to flag if combination of forename and surname fields is already in the...
6
by: Joey Lee | last post by:
Hi, I was wondering which is the best way of checking if a record exist in the database before inserting. There are quite a few ways I have seen. Here are some... 1> Insert and hit a...
16
by: MartinR | last post by:
I would like to know the code that i should use to delete a record without the message box saying "You are about to delete a record, are you sure..." poping up. At the moment i am using the...
7
by: brewer95 | last post by:
I use a form to enter data into a table. The user then has the opportunity to recall the data in the form based on a search to review and update the info. For example, on my menu there is a combo...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.