Default value for combobox on continuous subform ARRG!

  • Thread starter Thread starter serviceman via AccessMonster.com
  • Start date Start date
S

serviceman via AccessMonster.com

Hi gang,
Banging my head on the wall with this one:
I have a main form 'formadmintestmain' which has a continuous subform
'formadmintestpage1' on it. On this subform is a combobox (Combo55) that
saves its' data in field 'RQSTED_RANK'. Everything works as it should. What I
am TRYING to do is get this combo box to have a default value when
RQSTED_RANK is NULL:
If IsNull(Me.RQSTED_RANK) Then Me.Combo55 = DLookup("BELT_RANK", "STUDENTS",
"STUDENT_ID=" & Me.STUDENT_ID) + 1

This code works fine in a different form that have that does one student_id
record at a time, but I cannot get this to work for my continuous form. I'm
not exactly sure which event would be the best place to put this, either;
should it go in the On Current of the subform, the after update of the combo
box I use to select the main record from, or what? Any help will be greatly
appreciated!
Andy
 
Instead of using an event, try putting the expression in the combobox's
Default Value property (using IIF).

By the way, don't bang your head against the wall. Have one of the
students do it for you.
 
Hey Barry,
I'm not sure I follow you on using IIF;
What would the code look like?
Andy
 
IIF is just like If/Then, except that it can be used on a single line,
which you'd need for a control's property. In the combobox's Default
Value property enter the following:

IIF(IsNull(Me.RQSTED_RANK),Me.Combo55 = DLookup("BELT_RANK",
"STUDENTS", "STUDENT_ID=" & Me.STUDENT_ID) + 1)

Check IIF in the online help to see how this works.
 

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

Back
Top