473,804 Members | 3,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error in Validation Rule

A97. A database has a table: tblA which has a single text field, B. It is a
primary field, indexed and no duplicates. It is used as a lookup for table
tblC. A form based on tblA is used to add new records. The Validation Rule:
<>[Tables]![tblA]![b] was made using the expression builder. The rule produces
this error:
The expression [Tables] you entered in the Form control's Validation Rule
doesn't contain the Automation object 'Tables'

If I use simply: <>[b], it rejects everything because as soon as the focus is
moved from the text box to the close form command button, the value in the text
box is entered into the table producing a validation error.

What can I do to allow 'new' records to be entered into the table and to block
all duplicates and to have an error message display to say that the record
already exists?

All help will be greatly appreciated.

Just a wizard prodder
Chuck
--

Nov 13 '05 #1
6 3694
Chuck wrote:
A97. A database has a table: tblA which has a single text field, B.
It is a primary field, indexed and no duplicates. It is used as a
lookup for table tblC. A form based on tblA is used to add new
records. The Validation Rule: <>[Tables]![tblA]![b] was made using
the expression builder. The rule produces this error:
The expression [Tables] you entered in the Form control's Validation
Rule doesn't contain the Automation object 'Tables'

If I use simply: <>[b], it rejects everything because as soon as the
focus is moved from the text box to the close form command button,
the value in the text box is entered into the table producing a
validation error.

What can I do to allow 'new' records to be entered into the table and
to block all duplicates and to have an error message display to say
that the record already exists?

All help will be greatly appreciated.


The fact that [b] is the PK and has a unique index will already prevent
duplicates. You don't need the validation rule at all.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2
On Sun, 29 May 2005 14:11:21 GMT, "Rick Brandt" <ri*********@ho tmail.com>
wrote:
Chuck wrote:
A97. A database has a table: tblA which has a single text field, B.
It is a primary field, indexed and no duplicates. It is used as a
lookup for table tblC. A form based on tblA is used to add new
records. The Validation Rule: <>[Tables]![tblA]![b] was made using
the expression builder. The rule produces this error:
The expression [Tables] you entered in the Form control's Validation
Rule doesn't contain the Automation object 'Tables'

If I use simply: <>[b], it rejects everything because as soon as the
focus is moved from the text box to the close form command button,
the value in the text box is entered into the table producing a
validation error.

What can I do to allow 'new' records to be entered into the table and
to block all duplicates and to have an error message display to say
that the record already exists?

All help will be greatly appreciated.


The fact that [b] is the PK and has a unique index will already prevent
duplicates. You don't need the validation rule at all.


Your'e correct. But the data entery person doesn't know this because no
message of any type comes up. All that happens is that when you click 'Enter'
or 'Tab' the text box goes blank. The form stays open because it has its own
close command button. They could assume that the data has been entered, which
may not be all that bad since the data is in fact there. Maybe I'm trying to
gild the lily.

Just a wizard prodder
Chuck
--

Nov 13 '05 #3

"Chuck" <li*****@school link.net> wrote in message
news:fj******** *************** *********@4ax.c om...
duplicates. You don't need the validation rule at all.

Your'e correct. But the data entery person doesn't know this because no
message of any type comes up. All that happens is that when you click 'Enter'
or 'Tab' the text box goes blank. The form stays open because it has its own
close command button. They could assume that the data has been entered, which
may not be all that bad since the data is in fact there. Maybe I'm trying to
gild the lily.


Then you must have changed a setting that is preventing it. Attempting to enter
a duplicate value against a Primary Key or a field with a unique index has
always produced an error message for me.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #4
On Sun, 29 May 2005 15:53:12 GMT, "Rick Brandt" <ri*********@ho tmail.com>
wrote:

"Chuck" <li*****@school link.net> wrote in message
news:fj******* *************** **********@4ax. com...
duplicates. You don't need the validation rule at all.

Your'e correct. But the data entery person doesn't know this because no
message of any type comes up. All that happens is that when you click 'Enter'
or 'Tab' the text box goes blank. The form stays open because it has its own
close command button. They could assume that the data has been entered, which
may not be all that bad since the data is in fact there. Maybe I'm trying to
gild the lily.


Then you must have changed a setting that is preventing it. Attempting to enter
a duplicate value against a Primary Key or a field with a unique index has
always produced an error message for me.

If I did, I don't know what, when why, or how. I've checked every option,
setting and can't find anything that would let me turn warnings on or off.
I'm open to suggestions.

Just a wizard prodder
Chuck
--

Nov 13 '05 #5
"Chuck" <li*****@school link.net> wrote in message
news:nn******** *************** *********@4ax.c om...
On Sun, 29 May 2005 15:53:12 GMT,
"Rick Brandt" <ri*********@ho tmail.com> wrote:
Then you must have changed a setting that is preventing it. Attempting to
enter
a duplicate value against a Primary Key or a field with a unique index has
always produced an error message for me.

If I did, I don't know what, when why, or how. I've checked every option,
setting and can't find anything that would let me turn warnings on or off.
I'm open to suggestions.


Is there a specific reason why you created a custom Close button? That is why
the record is being discarded silently. There has been a bug going back several
versions now wherein using DoCmd.Close to close a form will silently discard a
bad record instead of alerting the user to the problem. If you were to close
with the X in the upper right you would get an error message.

You can keep the current button if you modify it to save the record before the
line that does the close. The line you need to add is...

DoCmd.RunComman d acCmdSaveRecord

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Nov 13 '05 #6
On Mon, 30 May 2005 13:57:21 GMT, "Rick Brandt" <ri*********@ho tmail.com>
wrote:
"Chuck" <li*****@school link.net> wrote in message
news:nn******* *************** **********@4ax. com...
On Sun, 29 May 2005 15:53:12 GMT,
"Rick Brandt" <ri*********@ho tmail.com> wrote:
Then you must have changed a setting that is preventing it. Attempting to
enter
a duplicate value against a Primary Key or a field with a unique index has
always produced an error message for me.

If I did, I don't know what, when why, or how. I've checked every option,
setting and can't find anything that would let me turn warnings on or off.
I'm open to suggestions.


Is there a specific reason why you created a custom Close button? That is why
the record is being discarded silently. There has been a bug going back several
versions now wherein using DoCmd.Close to close a form will silently discard a
bad record instead of alerting the user to the problem. If you were to close
with the X in the upper right you would get an error message.

You can keep the current button if you modify it to save the record before the
line that does the close. The line you need to add is...

DoCmd.RunComma nd acCmdSaveRecord

Works a charm. Thank You.

Chuck
--
Nov 13 '05 #7

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

Similar topics

2
2693
by: Joey P | last post by:
Hi all, I am doing a project for university whereby i have to implement a simple database related to a frozen foods company. I am having some trouble though creating a validation rule for one of my fields. I have a table called "Product" and two of the fields included in this table are "Cost Price" and "Retail Price". I need to create a validation rule so that the Cost Price is always less than the Retail Price. I have tried...
18
9050
by: Steve | last post by:
Hi I have a really weird problem and any assistance would be welcome. I have developed an app in Access 2002. The app runs perfectly on the development machine. I have packaged the app using the Microsoft XP Developer Packaging Wizard (Service Pack 1). The 1st 3 releases of the app ran perfectly on site.
1
1746
by: RyanL | last post by:
All, I have an append query set up that pulls records off of one table and appends them to a linked table. However, when the query runs, it gives me an error message saying that the records could not be appended due to a validation rule error. The wierd thing is there are no validation rules set up for any of the fields in either table. All fields are the exact same type and have the same properties. Any thoughts would be greatly...
7
5975
by: sharsy | last post by:
Hi guys, I would like to setup a validation rule for a database in microsoft access that restricts data entry so that a certain field can only be filled in if another field has a specific answer (that is selected via a drop down list). Example Field1 - options are "In" or "Out" Field2 - options are "Join" or "Not Joining"
1
2742
by: =?Utf-8?B?VmlqYXkgQ2hpa3Rl?= | last post by:
Hi Experts, With Session Affinity and Web Server Farm on ISA Server 2006 accessing 2 backend IIS servers, I’m getting error “Validation of ViewState MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKeyconfiguration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster”. Here is the scenario when I got the error.
2
19496
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
2
6903
by: ryan.paquette | last post by:
Hello' I have a field in which I require validation in a before update event. The validation code I have works fine, no problem there. However I would like to turn off the default validation error message...as it shows up in addition to the message I am providing. For some reason, (SetWarnings = False) does not apply to this error...
18
6235
by: ChipR | last post by:
I have a text box with a validation rule and validation text. When entering a new record, if I put in invalid text, the validation text is displayed in a message box, but after clicking OK, another message box is displayed with: ----------- myApplication (i bubble icon) The value violates the validation rule for the field or record. For example, you might have changed a validation rule without verifying whether the existing data matches...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9575
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10320
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10308
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7609
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.