null value in combo box (1 Viewer)

pillaisg

New member
Local time
Today, 11:58
Joined
Dec 13, 2007
Messages
8
How can i modify the code for getting a blank /null selection also in the combo box.

Private Sub Form_Load()

Cmb_PID_Inst_Type.RowSourceType = "Table/Query"
Cmb_PID_Inst_Type.RowSource = "Select Distinct PID_Inst_Type from T_master_pid"


End Sub
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:58
Joined
Oct 29, 2018
Messages
21,473
You can use a UNION query.
 

Gasman

Enthusiastic Amateur
Local time
Today, 08:58
Joined
Sep 21, 2011
Messages
14,301
Welcome back?
 

pillaisg

New member
Local time
Today, 11:58
Joined
Dec 13, 2007
Messages
8
You can use a UNION query.
Thanks for the reply. But in the due course I had added a line cmb_PID_Inst_Type= " " (highlighted in Red) which is actually what I was looking for.
But the sub form is not getting populated with the relevant data. (Subform query snap attached)
The requirement is based on selection in Ref_Type all records matching the criteria shall be appearing on the subform and further upon selection of PID_Inst_Type only records matching with Ref_Type and PID_Inst_Type shall be displayed .. like wise Installation_Type shall show all records in Subform based on selection on Ref_Type, PID_Inst_Type and Installation_Type.

The following is the code I had used. Any suggestion or observations on the below is appreciated.

Private Sub Form_Load()
Cmb_Enquiry_No.RowSourceType = "Table/Query"
Cmb_Enquiry_No.RowSource = "Select Distinct Enquiry_No from T_master_pid"
Cmb_Ref_No.RowSourceType = "Table/Query"
Cmb_Ref_No.RowSource = "Select Distinct Ref_No from T_master_pid"
Cmb_Ref_Type.RowSourceType = "Table/Query"
Cmb_Ref_Type.RowSource = "Select Distinct Ref_Type from T_master_pid"
Cmb_PID_Inst_Type.RowSourceType = "Table/Query"
Cmb_PID_Inst_Type = " "
Cmb_PID_Inst_Type.RowSource = "Select Distinct PID_Inst_Type from T_master_pid"
Cmb_Installation_Type.RowSourceType = "Table/Query"
Cmb_Installation_Type.RowSource = "Select Distinct Installation_Type from T_master_pid"

End Sub
 

Attachments

  • Q_MasterPID.jpg
    Q_MasterPID.jpg
    96.5 KB · Views: 27

Users who are viewing this thread

Top Bottom