Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / April 2006

Tip: Looking for answers? Try searching our database.

Default value for combobox on continuous subform ARRG!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
serviceman - 03 Apr 2006 18:55 GMT
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

Signature

A $300 dollar picture tube will protect a 10 cent fuse by blowing first-
Murphy

Barry Gilbert - 03 Apr 2006 19:49 GMT
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.
serviceman - 03 Apr 2006 19:59 GMT
Hey Barry,
I'm not sure I follow you on using IIF;
What would the code look like?
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.

Signature

A $300 dollar picture tube will protect a 10 cent fuse by blowing first-
Murphy

Barry Gilbert - 03 Apr 2006 20:50 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.