Solved

Data-bound combo box

Posted on 1998-08-30
7
493 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending a email via excel using vba 6 79
Excel VBA, find a string in a column, update a cell 7 75
Copy a row 12 61
Publisher:   Unknown     VB.exe Application 1 17
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

813 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

12 Experts available now in Live!

Get 1:1 Help Now