Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 9th, 2005, 07:35 PM
fliflo fliflo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 4 fliflo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 58 m 20 sec
Reputation Power: 0
validation rule

I need to create a validation rule that that hasto be different from the other field of the table.

Table Brother
Field1: ID
Field2: ID_BRO

ID has to be different from ID_BRO

i tried in ID validation rule

"<>[ID_BRO]" , does not work.

Is there a way

Please help

Reply With Quote
  #2  
Old May 10th, 2005, 03:19 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
You can use a simple code in the Before Update event for the ID field

If ID = ID_BRO Then
MsgBox "ID Must Not Be The Same As ID_BRO"
DoCmd.CancelEvent
SendKeys "{ESC}"
End If

This will cancel the event and place the curser in the ID field for a new or different entry before proceeding with the data entry.

If you use the <>[ID_BRO] without the quotes that will work also in the Validation Rule. You can type what message to display in the Validation Text in quotes..ex "ID must not be the same as ID_BRO"

lwells
Comments on this post
fliflo agrees!

Reply With Quote
  #3  
Old May 10th, 2005, 04:21 PM
fliflo fliflo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 4 fliflo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 58 m 20 sec
Reputation Power: 0
No problems with the first one thank u very much.

<>[ID_BRO] without "" does not work in validation rule

the error that appears is " Invalid SQL Syntax - cannot use multiple columns in a column-level CHECK constraint"

Strange?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > validation rule


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT