A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I use a table to validate data being entered into another



 
 
Thread Tools Display Modes
  #1  
Old March 23rd, 2010, 10:56 PM posted to microsoft.public.access
maritta
external usenet poster
 
Posts: 1
Default How do I use a table to validate data being entered into another

I have a table called DATA ENTRY into which data is being entered in a
CAMPAIGN field and 5 different UPC fields. The second table is called UPC
and has a CAMPAIGN field and one UPC field. This table has multiple records
with the same CAMPAIGN but each record has a unique UPC.

Now - each entry in the DATA ENTRY table's UPC fields needs to be looked up
in the UPC table to see if it is valid for the campaign. A "good" or "bad"
message should be returned to the form depending on the results of the lookup.

Please HELP - I am new to this!
  #2  
Old March 23rd, 2010, 11:20 PM posted to microsoft.public.access
Paul Shapiro
external usenet poster
 
Posts: 635
Default How do I use a table to validate data being entered into another

"maritta" wrote in message
...
I have a table called DATA ENTRY into which data is being entered in a
CAMPAIGN field and 5 different UPC fields. The second table is called UPC
and has a CAMPAIGN field and one UPC field. This table has multiple
records
with the same CAMPAIGN but each record has a unique UPC.

Now - each entry in the DATA ENTRY table's UPC fields needs to be looked
up
in the UPC table to see if it is valid for the campaign. A "good" or
"bad"
message should be returned to the form depending on the results of the
lookup.

Please HELP - I am new to this!


The design of DataEntry seems questionable. You should not have repeating
fields like UPC1, UPC2, etc. Generally you would structure those 5 columns
as 5 rows, similar to what you describe for the UPC table. Does DataEntry
have additional fields? A better name might help indicate it's purpose. Data
entry happens in all tables, so that's not very helpful as a table name.
Also, it's generally considered confusing to have a table with the same name
as one of it's columns. The UPC table might be better named something like
CampaignItem, if that's what it is.

Anyway, to enforce the rule that the {Campaign, UPCn} values in DataEntry
must match existing {Campaign, UPC} values in UPC, you would setup
referential integrity. It's easier with well-designed data structures, but
with your existing structure you would create 5 enforced relationships from
UPC to DataEntry. Each relationship would have UPC{Campaign, UPC} as the
parent table, and one of the five DataEntry{Campaign, UPCn} as the child
table.

Since you didn't mention what Access version you're using, check the online
help for "referential integrity" for more instructions. Access 2007 has some
reasonably extensive discussion along with the instructions. I don't
remember what was in earlier versions.

 




Thread Tools
Display Modes

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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:35 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.