Solved

Using values form dropdown box to set field default value

Posted on 2010-11-17
2
857 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

739 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