Solved

Data-bound combo box

Posted on 1998-08-30
7
496 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
Technology Partners: 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

Independent Software Vendors: 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!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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