-
November 22nd, 2005, 11:57 PM
#1
Auto display Text...Urgent one
Hi I had Two Comboboxes
1) cboitemname
2) cboitemcode
I maintained Description of ItemCode & Corresponding Item Name in Access Named as Item_master
Problem : Suppose i select item Name Then Corressponding Item Code Should populate Automatically or Vice-Versa......
How do I Code that
Raj - IDEA Cellular Ltd.
-
November 23rd, 2005, 12:04 AM
#2
Re: Auto display Text...Urgent one
There are two ways in which u could do it.... since the name and code must be in a single row of the database ....... the time they are added in the combobox they can be recognised by indexex......so once a name is clicked point the item code to the same index as that of the name.....
the other way u can do it is by simply searching the code combo for your required item.
-
November 23rd, 2005, 12:10 AM
#3
-
November 23rd, 2005, 12:52 AM
#4
Re: Auto display Text...Urgent one
Originally Posted by rahul.kul
HI Raj.. !
I have done this type of code in my software already...see like this..
For doing this.. you have to fill first combo sorted on a autonumber field with the Item code. and then another one with Item Description also sorted with the same auto number field. so that Item code and Item Descriptions have same List indexes in both combo boxes..
Now write a Click event for both combo boxes.. and set the listindex equals to the other's Listindex.. so that if I select 4th Item In Item Code Combo, then it automatically selects the 4th Item iN Item Description..
Code:
sub combo1_click()
combo2.listindex = combo1.listIndex
end sub
sub combo2_click()
combo1.listindex = combo2.listIndex
end sub
and I hope it will helps you
Rahul Kulshreshtha
ABB
Rahul is absolutely right! but one more thing is that u must set 'sort' property=false for combo boxes and u must fire the query with order by clause so that both combos will be having same order and whenever u'll assign listindexes of both combos they will give correct corresponding value...bye
-
November 23rd, 2005, 01:20 AM
#5
Re: Auto display Text...Urgent one
Thanks to Rahul & Manju......
Have a gr8 time.
-
November 24th, 2005, 04:53 AM
#6
Re: Auto display Text...Urgent one
I'M BACK AGAIN !!
-------------------------------------------------------------------------
enjoy the VB !
If any post helps you, please rate that.
Always try to findout the Solutions, instead just discussing the problem and its scope!
-
November 26th, 2005, 01:43 AM
#7
Re: Auto display Text...Urgent one
if u have both the fileds (Itemcode and ItemName) in same table and want to fill both the combos as Form_Load event then use the following code......
Code:
'In Gerenal Section of Form Code
Dim Rsitem as Adodb.Recordset
Private Sub Form1_Load()
Set Rsitem=New Adodb.Recordset
Rsitem.open "Select Itemcode,Itemname from Tablename order
by Itemcode",conn
cboitemcode.clear
cboitemname.clear
while Rsitem.EOF=False
cboitemcode.Additem (Rsitem!Itemcode)
cboitemname.Additem (Rsitem!Itemname)
Rsitem.MoveNext
wend
End Sub
'The above code will make indexes of itemcode and itemname same in both the combos.
'now use the code for index changes done by Rahul
Originally Posted by manju_ambare
Rahul is absolutely right! but one more thing is that u must set 'sort' property=false for combo boxes and u must fire the query with order by clause so that both combos will be having same order and whenever u'll assign listindexes of both combos they will give correct corresponding value...bye
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|