Solved

Data-bound combo box

Posted on 1998-08-30
7
497 Views
Last Modified: 2010-04-30
I am trying to write a simple recipe management program, using a data control and a data-bound combo box.  I want the combo box to be populated using all the recipe names on file for a certain category (e.g., list all the recipes from the "Appetizers" category).  My data control's RecordSource property is a query (list all recipe names where the category = "Appetizers").  The combo box populates correctly, but when I select one of the entries, my other text boxes are not updated with the data for that recipe (even though their DataSource and DataField properties point to my database). If I put in a Data1.Refresh in the dcCombo_Change event, the combo box text is always changed back to the original selection.  How do I update the current record to indicate a new selection from the combo box?
0
Comment
Question by:tttaff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 1

Accepted Solution

by:
disha earned 50 total points
ID: 1431927
Hi,
The data control or other controls wont move to that record automatically. In the combo click event, get the index of that combo list in a var A and then move the data control after refreshing to that record no using a for loop. i.e do MOVENEXT from 0 to A times.
Regards

0
 
LVL 1

Expert Comment

by:disha
ID: 1431928
Hi,
I am sorry...Forget the upper part....I was confused ...
just use this...it will work
data1.recordset.bookmark = dbcombo1.selecteditem

where dbcombo1 is bounded to u'r data1 control
0
 

Author Comment

by:tttaff
ID: 1431929
Following your suggestion, I entered the following command in my
dbcRecipeName_Change event:

    dtaAppetizers.Recordset.Bookmark = dbcRecipeName.SelectedItem

dbcRecipeName is the combo box; dtaAppetizers is my data control.

When I run the program, I get the following error after selecting an entry fromthe combo box:

     Run-time error '3426':

     The action was cancelled by an associated object.


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:disha
ID: 1431930
put it into u'r click event of the combo...not in the change
event.what is the error message it gives with error no 3046.

Regards
0
 

Author Comment

by:tttaff
ID: 1431931
I tried putting this into the combo box click event as you suggested - same error as before: '3426"
0
 

Expert Comment

by:uyeshiro6
ID: 3928992
Hi tttaff,

Did you get your problem fixed?  The reason is I have the same problem/need as you have and am looking for a solution.  I have  categories  and subcategories and want only to bring up the subcategories of the selected category, using data cbo.   I'm new to VB6.  Have done this in Access many times...

Ron
0
 

Expert Comment

by:uyeshiro6
ID: 3929250
Hi tttaff,

Did you get your problem fixed?  The reason is I have the same problem/need as you have and am looking for a solution.  I have  categories  and subcategories and want only to bring up the subcategories of the selected category, using data cbo.   I'm new to VB6.  Have done this in Access many times...

Ron
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question