Solved

Filling a DBCombo Box

Posted on 1998-12-19
7
297 Views
Last Modified: 2013-12-25
Using VB4.0 Enterprise Edition
Have a database named carbo.mdb with a field named FoodType.  Set the properties in a Data Control named Data1.  When I click on properties of the DBCombo, I do not get a list of properties to set.  Using code like this:

   Set DBCombo1.RowSource = Data1

   Set DBCombo1.ListField = FoodType

produces an error.  How do I populate the DBCombo Box with the entries in the FoodType field?
0
Comment
Question by:critter017
7 Comments
 
LVL 12

Expert Comment

by:jgv
ID: 1498414
1. Set the DatabaseName (carbo.mdb) for Data1
2. Set the RecordSource (a table from carbo.mdb=FoodType?) for Data1
3. Set the RowSource (Data1) for DBCombo
4. Set the ListField (a field from FoodType table) for DBCombo

This can all be set at design time. I am using VB5 and am not sure how VB4 is setup but I hope this helps.
0
 
LVL 1

Author Comment

by:critter017
ID: 1498415
Where do I set the RowSource and ListField properties?  I do not get a property window when I click on "properties" in design view and have the DBCombo box selected.  This is my problem.  Everyone gives me the same answer, but the code does not work and I have no properties window.  What am I doing wrong?
0
 
LVL 12

Expert Comment

by:jgv
ID: 1498416
As I've said, I have not used VB4 and am unfamiliar with it's layout. In VB5 there is a properties window at bottom-right of screen. I can show it by selecting 'View' from the menu bar then 'Properties Window' or the shortcut is F4. Right clicking on the DBCombo box and selecting 'Properties' does not show Recordsource or Listfield. The Recordsource, to my understanding, must be set at design time and that is why your code is causing an error. If this does not help then you will have to wait to hear from an expert that has used VB4. Sorry.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 2

Expert Comment

by:JiaH
ID: 1498417
How about use the F2 to open the object browser to see, does there exist the two properties you needed?
0
 
LVL 3

Expert Comment

by:altena
ID: 1498418
With the risk of starting religeous wars....

I always populate my "lookup" Combo's and list-boxes by hand.
In VB 4 you can write a module to populate your lookup lists
and re-use these in various aplpications.
in VB5 and 6 you can write a user-control that you can re-use
in other applications.

On the other hand... This may be something between me and the data-bound-write-your-program-without-coding-and-not-having-a
-clue-about-what-happens-with-setting-1.000.000-properties-club

Good Luck :=)
0
 
LVL 1

Author Comment

by:critter017
ID: 1498419
Thank you "jgv".  I feel so dumb.  Obviously, I haven't been playing with Visual Basic very long to not know about the F4 shortcut.  Please redo your comment as an answer and I will be happy to award you the points.
0
 
LVL 12

Accepted Solution

by:
jgv earned 50 total points
ID: 1498420
critter017:
Glad I could help. Everyone gets stumped by a simple oversight once in a while so don't sweat it.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

839 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