i want to add one elsement at o'th index of ComboBox ...
like this
"---Select---"
how can i do thisd and on which event ??
pls help me regarding this with code..
ohh i am sorry,
i am using access and i want to add new element on 0'th index as
"--select--" and user should able to see this "--select--" before user select any thing from ComboBox
You go to your table. Click on the Design feature. Go to "combobox1" under the field properties section click on default value and input your value there.
i had try the solustion which you told me, i have done this step's but no result Dude..(Click on the Design feature. Go to "combobox1" under the field properties section click on default value and input your value there)
pls help me any one...
to add element to a combobox, use the code combo1.additem "your element here"
On error goto Trap
Trap:
in case of emergency, drop the case...
****************************************
If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved" option. if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar
Just using combo1.additem "your element here" will add it to the end of the dropdown list.
You need to specify the index position of 0 to get it as the first item.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
yes i have one Combo Box which is retrive value from one table and i have one sub form on same form when i select records from Combo box subform will show me records according to that selecttion, when i search the property Combobox1.additem it is not there .... i am doing all this in Access as i told early thanx and pls help me regarding this ...
i am not able to find the property like combo1.additem "your element here"
Click on the properties of the combo box....Locate the record source type (this should be table/query) for record source choose the table in the drop down list...
I suppose your going to use ADO/DAO code for that since your project specification requires you to select a value in the combo box and change the data in your subform...Have you tried using DAO/ADO?
i am new in Access i did't know about the ADO/DAO i only select DropDown From ToolsBox and place it on form it ask me to ( I want ComboBox to LookUp the Values in a table or Query ) and i link it .. that's it..
which version of Access are you using and the term "combobox1" is a generic term I was using in place of the name of the combobox you are trying to name.
When you go to your table and go into design view. Select the name of the combobox and there will be a set of fields at the bottom of that screen find the section for Default Value. This sets the combo box to this name every time it opens. When you select a different value from your list it will change the name on the default value to your value you selected and store that information in the table for the new record.
I have attatched a generic table form to show you what I mean when this happens.
(I have access 2000 and using this exact technique.)
Last edited by jmhfloor; Mar 3rd, 2006 at 09:28 AM.
I suppose you have a table named customer with a primary key of CustomerID..And in your form you added textboxes bound to the fields and the combo box for searching the customerID.The combo box is not bound to the table.The record source type should be Table/Query...Use sql statement in the record source of the combo box....
Example...
Select Customer.CustomerID, Customer.CustomerName, Customer.CustomerAddress from Customer;
Then in your combo box named Combo8, attach this code...