Default Field Value

W

Wookawsh

Sorry if this is a repeat question, but Im not sure if my original message
was posted.

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" Menu, and putting in
for the other fields: =[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
 
W

Wayne-I-M

The simplest method would be to use a form with subforms - linked by your
Study ID

Copy your database and give it a try on the copy.

Create a form from the main table
Create another form from the other table

Open the main form in design view
use the toolbox to select subforms
insert a the subform (the form from the other table) and select Study ID as
the linking field

You don't need any code writting ability to do any of this - but it would
help if you has a little later on to make the databsee work better or just to
run functions that you may decide you would like

Good luck
 
W

Wayne-I-M

just noticed this section in your post

Im using the expression builder in the "Default Value" Menu, and putting in
for the other fields: =[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.


The reason it is wrong is that the main form (with study ID may not opened).
If it is you need to include the form name as well as the control name -
something like this
Forms![FormName]![ControlName]
 
W

Wookawsh

Wanted to thank you for your quick answers. Ill give them a try.
--
Lukasz


Wayne-I-M said:
just noticed this section in your post

Im using the expression builder in the "Default Value" Menu, and putting in
for the other fields: =[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.


The reason it is wrong is that the main form (with study ID may not opened).
If it is you need to include the form name as well as the control name -
something like this
Forms![FormName]![ControlName]






--
Wayne
Manchester, England.



Wookawsh said:
Sorry if this is a repeat question, but Im not sure if my original message
was posted.

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" Menu, and putting in
for the other fields: =[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
 

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