How can I store data in different object i.e. in ComboBox or TextBox from database Table in Access 2002 in VB6?
Dear Friend
I have a database table in Microsoft Access 2002 and there is Usercode wise data under Username, Itemname, Itemcode, Warrenty fields etc.
Now I want to store all the data against the Usercode from database table in different objects i.e. in ComboBox or TextBox which is placed on a form in VB 6.0. That is, when I shall select Usercode from the ComboBox, for example 1, all the data under Usercode 1 will be stored in Combobox or TextBox. After been retrieved all data against Usercode 1, I will select my desired data from the ComboBox or TextBox and will save to the different table. Several data against Usercode 1 already been stored in the table. Similarly, I shall again select Usercode 2 and data against Usercode 2 will be retrieved from the table in different objects as mentioned above.
EXAMPLE: For Usercode 1 & Username: Md. Shahriar Alam, Itemname=LAPTOP/UPS/TELEPHONE etc. Brand=DELL/SOCONIC etc. Itemcode=100-1,200-2 etc. Warrenty=YES/NO etc. in the database table.
I have used below coding, but it is only showing last inserted record.
CODE:
Private Sub cmbusercode_LostFocus()
Dim rst As New ADODB.Recordset
DBconnect
If rst.State = adStateOpen Then rst.Close
rst.Open "tblpurchasesupplyqty", cnt, adOpenDynamic, adLockOptimistic
While Not rst.EOF
If cmbusercode.Value = 1 Then
txtusername.Text = rst.Fields(2)
cmbitemname.Text = rst.Fields(0)
cmbbrand.Text = rst.Fields(4)
cmbitemcode.Text = rst.Fields(1)
txtwarrenty.Text = rst.Fields(9)
End If
rst.MoveNext
Wend
End Sub
It is really urgent to me to be finished my program. So, appreciate if you would come back soon with the solution.
Regards
Pervez
![]() |
![]() Coffee Table or Telephone Table US $1.00
|
![]() VINTAGE TURQUOISE TABLE TOP DIAL TELEPHONE BELL SYSTEMS 1968 US $20.49
|
![]() B W Photo T5615 Man at table on telephone US $5.98
|
Tagged with: 2002 • Access • ComboBox • data • database • different • From • i.e. • object • store • Table • TextBox
Filed under: Telephone Table FAQ
Like this post? Subscribe to my RSS feed and get loads more!


US $24.99






Leave a Reply