Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with combo boxes

Status
Not open for further replies.

iman1

Programmer
Aug 20, 2004
11
OM
First point:
I have many tables

TblDirectorate
app_no
dir_no
dir_name

TblDepartment
app_no
dep_no
dep_name
dir_no

TblSection
app_no
sec_no
sec_name
dep_no

TblApplication
app_no
date
no_of_printer
no_of_PCs

I created three combo boxes in the form by using wizard:

cmbDirectorate
Row Source:
Select TblDirectorate.dir_no,TblDirectorate.dir_name From TblDirectorate;
Column Count:2

cmbDepartment
Row Source:
Select TblDepartment.dep_no,TblDepartment.dep_name,
TblDepartment.dir_no From TblDepartment Where (((TblDepartment.dir_no)=[forms]![name of the form]![cmbDirectorate]));
Column Count:2

cmbSection
Row Source:
Select TblSection.sec_name,TblSection.sec_no,
TblSection.dep_no From TblSection Where (((TblSection.dep_no)=[forms]![name of the form]![cmbDepartment]));
Column Count:2

code:

Option Compare Database
Private Sub cmbDirectorate_Change()
cmbDepartment.SetFocus
cmbDepartment.Value = Null
cmbDepartment.Requery
cmbDepartment.Value = cmbDepartment.ItemData(0)
cmbSection.SetFocus
cmbSection.Value = Null
cmbSection.Requery
cmbSection.Value = cmbSection.ItemData(0)
cmbDirectorate.SetFocus
End Sub

Private Sub cmbDepartment_Change()
cmbSection.SetFocus
cmbSection.Value = Null
cmbSection.Requery
cmbSection.Value = cmbSection.ItemData(0)
cmbDepartment.SetFocus
End Sub

Now the problem is : when I click on the drop down arrow of the first combo box, it doesn't show me the item that I have selected it and when I click on the drop down arrow of the second and third combo boxes, they don't contain any item(empty)and I don't know what is the problem ....!

The second point:

I told you I created combo boxes in a form ,but this form also contains other text boxes like :
app_no,date,no_of_printer,no_of_PCs from TblApplication.
I think it is clear that the record source of this form is a query because we took the fields of text boxes + fields
of combo boxes from several tables.

Now the problem is that when I want to add new records for the above fields, the data entered in the form except
app_no,date,no_of_printer,no_of_PCs fields can be duplicated which will make the values in combo boxes duplicated and this is shouldn't be.

I couldn't find a solution for this problem .
so, could you help me.....!








 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top