Solved

Data-bound combo box

Posted on 1998-08-30
7
491 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
  • 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now