Creating a Default Value

W

Wookawsh

Im trying to set the default value of several of my fields to the value of
one of my primary key fields.

Essentially I have a patient ID field called "STUDY ID" (primary key) that
is in One to many relationship with the STUDY ID field in other tables.
Instead of inputting this value over and over again in the various tables, I
would like to just enter it one time in a Form that I have designed. Then the
"ID" fields in the other tables will automatically get updated.

Im using the expression builder in the "Default Value" box, and putting in
=[STUDY ID] as the default value. When I try to save this, an error message
pops that that says that "STUDY ID" field cant be found.

Any suggestions would be appreciated. I have very limited coding ability.

Thanks
 
J

John W. Vinson

Im trying to set the default value of several of my fields to the value of
one of my primary key fields.

Essentially I have a patient ID field called "STUDY ID" (primary key) that
is in One to many relationship with the STUDY ID field in other tables.
Instead of inputting this value over and over again in the various tables, I
would like to just enter it one time in a Form that I have designed. Then the
"ID" fields in the other tables will automatically get updated.

A default value is NOT a good way to manage this. This PatientID in the
"other" tables is a "foreign key"; as such, you should probably never even
*see* it, much less enter it!

The normal way to enter foreign key values would be to use a Form for the
"one" side table (the patient table, it seems here), with one or more Subforms
for the related tables. If you set the Master and Child Link Field properties
of the Subform control to [STUDY ID] you'll keep the tables synchronized
without any need for code, or even for displaying the ID in the child form.

If you're using table datasheets to enter data.... well, don't. That's not
their function and they do not have the tools that you need.
 

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