Solved

Using values form dropdown box to set field default value

Posted on 2010-11-17
2
863 Views
Last Modified: 2013-11-28
Hello Experts!

How can I assign a field's default value from a selected value in dropdown box?

Background:

tblStudent table (lists all students and attributes with a school field call tblSchool). I could set the default value of this field to, say "Pacific High School", in design view but more that one school will use this database. I have another table with settings, tblSettings that I keep the school's name. Users can set the name when they first login to the application by selecting  their school  name in a drop down box. Their selection is written to the tblSettings table, tblSettings_School field.

What I would like to do is when a new record is written the default value for the School field in the tblStudent table will default to the value listed in tblSettings, tblSettings_School field.

I tried setting the default value in design to [tblSettings].[tblSettings_School] but that didn't work.

Any help you can provide would be great

Thanks in advance for this?
0
Comment
Question by:shogun5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
t_hungate earned 500 total points
ID: 34161346
You can create a hidden txt box on your form with a control source of  [tblSettings].[tblSettings_School], name it txtDefaultSchool. Then on your form, just set the school field to match the txtDefaultSchool, unless changed by the user.

TLH
0
 

Author Closing Comment

by:shogun5
ID: 34161505
Okay, that will work too. I had to use =Nz(DLookUp("tblSettings_School","tblSettings"),0) as the control source for txtDefaultSchool and then assigned this value to txtSchool field on the Form Load event.

Thanks again!
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question