Solved

Filling a DBCombo Box

Posted on 1998-12-19
7
293 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

910 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

20 Experts available now in Live!

Get 1:1 Help Now