Help: combo box trouble

fargos99

Registered User.
Local time
Today, 20:29
Joined
Sep 1, 2000
Messages
12
Please help I am a student doing this project for my HNC and I am completely stuck.

I have designed a database with one table and one form, the form has a number of comboboxes which show various items and their prices (though their default value is ‘none’). The comboboxes are based on different queries from the table, and each selection decides (via an ‘if’ statement) which query is used as a source for the subsequent combobox, then I hit calculate and I get a total. The trouble is that when I reset the comboboxes, any of them which may have had their source 'changed’ at run time now revert to a null rather than the ‘none’ which I want.

The code for my reset button is:


Private Sub lblreset_Click()
DoEvents
txtsubtot = ""
txtvat = ""
txttot = ""

'resets address box
Textcust1.SetFocus
Textcust1.Text = ""
Textcust2.SetFocus
Textcust2.Text = ""
Textcust3.SetFocus
Textcust3.Text = ""
Textcust4.SetFocus
Textcust4.Text = ""
Textcust5.SetFocus
Textcust5.Text = ""


'resets combo boxes
cmbcase = Empty
cmbmother = Empty
cmbmem = Empty
cmbhdd = Empty
cmbvid = Empty
cmbsnd = Empty
cmbcd = Empty
cmbmon = Empty
cmbmse = Empty
cmbkybrd = Empty
cmbmodem = Empty
cmbproc = Empty
cmbsoftware = Empty
cmbwarranty = Empty
cmbcdrw = Empty

Textcust1.SetFocus
DoEvents
End Sub
 
Default value only appear once in combo box when you first open the form. If you want it back to "None", you should set those combo box to "None" by code under click event of your Reset button. Because you set them to Empty, that's why it returns Null instead of "NOne"
 

Users who are viewing this thread

Back
Top Bottom