Solved

VB6 & ADODC Using SQL

Posted on 1998-10-12
2
1,081 Views
Last Modified: 2013-12-25
Using VB5 Ent., I have written a program using a number of controls (bound & unbound).  I've tried updating to VB6 Ent. using ADODC.  I have a DBCombo bound to a DAO control to load the contents into the list, which works fine with ADODC.  The problem is that I load a DB Grid with a second ADO data control using the bound text from the DBCombo.  When I try to assign the grid using sql on the second control without specifying a recordsource, I get an error stating same.  I can't use sql in the properties of the ADODC because it is reliant on the bound column of the DBCombo.

Any ideas would be great.

   
0
Comment
Question by:nu2vb
2 Comments
 
LVL 3

Accepted Solution

by:
TheAnswerMan earned 50 total points
ID: 1496847
What I usually do is Assign a SQL Statement that will return no rows.  IE "SELECT CompanyNumber From CompanyList WHERE CompanyNumber = "XXXX"
Then. the grid will be empty.
When the User Clicks on an Item in the Combo.. the Recordsource is
Select * from CompanyList WHERE CompanyNumber ='" & cboList & "'"

I also use this technique when I know the recordset is quite large, and I dont want the user to wait for it to load, just so they can select another one from the list.
0
 

Author Comment

by:nu2vb
ID: 1496848
Excellent!  
Something so simple and it works - Thanks for pointing it out.  I will also use it like you said - With large recordsets!

Thanks again.........
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

759 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

18 Experts available now in Live!

Get 1:1 Help Now