Validate information

J

Joseph

I have a table with 3 fields licence number = 6
characters / name of license holder & address off licence
holder. The second table are individuals who may operate
under those license numbers in the first table. My
question is can I validate or restrict the information
entry into the second table with only valid license
numbers that exist in the first field of table one?

Any help would be greatly appreciated.
 
D

Duane Hookom

Licence Number in the first table should be a primary key. You can then set
your relationships to enforce referential integrity.
 
G

Guest

Thanks, I tried this but I have a problem. It will not
allow me to add any records because a related record is
required where the field is a primary key.

Any help?
Thanks Again
 
D

Duane Hookom

Could you provide your table structures and which are the primary and
foreign keys? Which table can't you enter records into?
 
G

Guest

This may sound st*&*()) but how do I provide it?
-----Original Message-----
Could you provide your table structures and which are the primary and
foreign keys? Which table can't you enter records into?

--
Duane Hookom
MS Access MVP





.
 
D

Duane Hookom

Reply to the group and type in something like:

tblTableA
=================
FieldA Numeric Primary Key
FieldB Text
FieldC Date
FieldD Text

tblTableB
=================
Field1 Numeric Primary Key
FieldA Numeric Foreign Key to tblTableA.FieldA
Field3 Date
Field4 Numeric
 
G

Guest

Thanks for the help.

TableOne
==========
Base license # Text Primary
Company Name Text
group name Text

TableTwo
=========
dbase licence # text
t license # text
t license exp date/time
first name text
last name text

Thanking you again for all your help.

Joseph
 
D

Duane Hookom

Your fields don't exactly match with your early post. Regardless, how are
the tables related? My example suggested which field value in table2 is
related to the primary key of table1.
 
G

Guest

Table one base licese # is the primary. The dbase license
# in table two is the same. I would like to create a way
by which the user could not enter information for anyone
if the dbase license does not exist in table one base
license #.

Joseph
 
D

Duane Hookom

Go back to my first reply. Do you understand how to create relationships
between tables?
 
G

Guest

Hi Again,

I thought I did. By creating the relationship between the
the 2 tables and having checked off referential integrity
relationship type one-to-many gives me an error message
of 'You cannot add or change a record because a related
record is required in 'table2'.
 
D

Duane Hookom

Remove any relationships by clicking any join lines and pressing the delete
key. Then grab and drag the primary key from your one table (it should be
bold) and drop it on the similar field in your second table. Set the join
property to enforce referential integrity. If this can't be accomplished due
to records in table two that don't have a matching record in table one then
either add the record to table one or delete the record(s) from table two.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top