Combo Box Default Value

C

channell

I have read a lot, but I still can't find an answer.

I have a combo box with a short list of work positions in it. I have
assigned each employee a work position, but it is also possible to change it
if they work somewhere else for a day or extended period of time. I want the
combo box to set their default position when I create a new record.

I am using the DLookUp function, and I have also tried "On Load" Event.

=DLookUp("[PRELOAD POSITION]","tEMPLOYEES","[EMPLOYEE ID]")

I am stuck. Thanks!!
 
K

Ken Sheridan

Scott:

Now you've got me puzzled. I thought from your other thread that you
now only have the PositionID column in the tblEmployees, but it sounds
like you still have it in the tblDailyInfo table as well. If so, then
by using the code I gave you there to insert multiple rows into
tblDailyInfo, it won't insert a value into the PositionID column. For
that to happen the SQL statement would also have to insert the
position value to happen.

The method you are attempting now will only work when inserting an
individual record into tblDailyInfo via a form, but you should not try
and set the DefaultValue property but instead insert a value into the
PositionID control in the AfterInsert event procedure of the
EmployeeID control with:

Me.PositionID = DLookup("Preload Position", "tblEmployees",
"EmployeeID = " & Me.EmployeeID)

Note that the third argument is an expression built by concatenating
the literal string "EmployeeID = " to the value of the EmployeeID
control.

Again you'll find an example of this in Northwind, in the OrderSubform
where code in the AfterUpdate event procedure of the ProductID control
assigns a value to the UnitPrice control.

Ken Sheridan
Stafford, England
 
G

Gina Whipp

Channell,

Try putting it on the On-Current Event of the form OR on the after update of
the combo box which selects the employee. I would probably prefer the
After_Update of the combo box of selecting the employee

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index.htm
 

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