remain null to force selection

G

Guest

i have 3 interdependent combo boxes...region, department, and requestor. the
options to choose from in the department box are filtered based on the region
selected. the options to choose from in the requestor box are filtered based
on the department selected.

my problem is that when a region is selected, the department and requestor
boxes automatically default to their respective first values. im looking for
the following to occur:

1. user selects region
2. department box remains blank, but cannot remain null, so that the user is
forced to make a selection
3. once department is selected, requestor box remains blank, but cannot
remain null, so that the user is forced to make a selection

in short, i would like the boxes to default to a blank value, forcing the
user to make a selection, but require that a selection be made prior to
saving the record.

here is the code that i currently have:

Option Compare Database

Private Sub Combo44_AfterUpdate()
Combo46.Requery
Combo46.Enabled = True
Combo46 = Combo46.ItemData(0)
Combo47.Requery
Combo47.Enabled = True
Combo47 = Combo47.ItemData(0)
End Sub

Private Sub Combo46_AfterUpdate()
Combo47.Requery
Combo47 = Combo47.ItemData(0)
Combo47.Enabled = True
End Sub

Private Sub Form_Current()
If IsNull(Combo44) Then
Combo46.Enabled = False
Combo47.Enabled = False
Else
Combo46.Requery
Combo46.Enabled = True
If IsNull(Combo46) Then
Combo47.Enabled = True
Else
Combo47.Requery
Combo47.Enabled = True
End If
End If
End Sub

Private Sub Form_Load()
'nothing - Current event will be fired
End Sub


What in this code do I need to modify in order to accomplish the above?

Thanks!!!
 
G

Guest

You are currently assigning values to the controls with the lines:

Combo46 = Combo46.ItemData(0)
Combo47 = Combo47.ItemData(0)

If you omit those lines then the controls should remain blank. You might
like to consider moving focus to and calling the DropDown method of each of
the two controls after requerying it in the AfterUpdate event of the control
immediately above it in the hierarchy so that the restricted list drops down
for the user to select an item once a value has been selected from the
preceding control.

Taking a wider view, however, I suspect that your table might contain some
redundancy in that the Region is implied by the Department and Department is
implied by Requestor, meaning that the last of these is the only one which
needs to be stored as a column in the table, and moreover should be to avoid
the risk of anomalies to which the redundancy gives rise. You'll find a demo
of a number of ways this sort of data can be handled via correlated combo
boxes without introducing any redundancy at:


http://community.netscape.com/n/pfx...yMessages&tsn=1&tid=23626&webtag=ws-msdevapps


This uses the three levels of local administrative areas in my location as
an example, but it looks to me like the principle is just the same in your
case.

Ken Sheridan
Stafford, England
 

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