VB6: Getting List of records from one field of Microsoft Access Table in ComboBox

45 pts.
Tags:
ComboBox
Microsoft Access
VB 6
VB error handling
Visual Basic 6
Visual Basic runtime errors
VB6: Dear sir, For the following code I am getting "Run-time error'3265': Item cannot be found in the collection corresponding to the request name or ordinal." However, I already connected Adodc1 to my database from where I want the data. Actually, what Im trying to do is, just to get record list from particular field of Table from MSAccess Database in my ComboBox, so I could retrieve the record. I was using DBCombo1 and used "ListField" in the properties and connected it to Adodc1 but I could only succeed in getting records in the list but if I select any record suppose "CustomerID" it is not getting the rest of record like "CustomerName" and "Address" etc. in TextBoxes Im using in my VB Form. I tried many times but could not succeed. Please if anybody can help me in it. I will be so grateful because I have to finalize my company database with in few days. Thanks in advance. Have a Good Day...!!!. If Adodc1.Recordset.RecordCount <> 0 Then Adodc1.Recordset.MoveFirst Adodc1.Recordset.Find "ID='" & DBCombo1.Text & "'" If Adodc1.Recordset.EOF = False Then If Adodc1.Recordset!FirstName <> "" Or IsNull(Adodc1.Recordset!FirstName) = False Then Text1.Text = Adodc1.Recordset!FirstName Else Text1.Text = "" End If If Adodc1.Recordset!Address <> "" Or IsNull(Adodc1.Recordset!Address) = False Then Text2.Text = Adodc1.Recordset!Address Else Text2.Text = "" End If End If End If End Sub
ASKED: April 14, 2009  7:50 AM
UPDATED: April 15, 2009  6:22 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Well, a simple-minded person like myself (IQ 154) would just run the query wizard and select only the field you want to see. You can print your list of records from the query or do whatever you have in mind.

Juju

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Subbu2k9
    Hi Scorpian, You need not any ADODB object, it is very simple follow these steps. 1. Open your Access Form in Design mode 2. Select the combo box and right click and select its properties 3. You will get all properties of combo box and type the following SQL at "Row Source" Property, thats it. select fieldname from tablename. Example: select empname from emp; The above query will display all employee names from emp table in combo box when you open your FORM. Feel free to ask me any Access questions. Subbu.
    90 pointsBadges:
    report
  • Subbu2k9
    Sorry, I miss one more property, Select RowSource Type property as Table/Query before giving SQL query to Row Source. Hope you will understand my answer.
    90 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following