MS-Access like Combobox in VB6

15 pts.
Tags:
Microsoft Access
Visual Basic 6
Need to create a combobox in a VB6 form having the following properties 1. It will populated from a table/query. 2. It will bound to a table and the selection will be stored in that table. (as access) 3. It will allow typing a data that is not in the list.

Answer Wiki

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

1. I don’t know of a way to populate a combo from a table/query automatically in VB6. You would have to programmatically connect to the database, execute a query and use the resultant recordset to add items to the combo, one at a time (with a loop).

2. You would need to include a data control (data, oradc, adodc, etc., depending on the database and how you want to connect to it) in your form, and set the properties needed to connect it to a specific database table (the one where the combo selection will be stored), then set this data control as the data source of your combo box, and set the appropriate table column name to its DataField property.

3. That is the default behavior of a combo box, but if you want these new values to be inserted into the look up table where the combo was populated from, you would have to write the necessary code in some event handler of the combo (the validate event, for example).

Hope this helps.

Discuss This Question: 3  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
  • carlosdl
    So, what is the question ?
    69,510 pointsBadges:
    report
  • WhoKnowsNothing
    Carlosdl 34690 pts. | Mar 17 2010 5:16PM GMT So, what is the question ? The most important question is "How to do the second?"
    15 pointsBadges:
    report
  • WhoKnowsNothing
    [...] MS-Access like Combobox in VB6, asked by WhoKnowsNothing and answered by [...]
    0 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