Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 17th, 2003, 03:14 PM
Authorized User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADO Data Control

Bit of a newbie going through Peter Wright's Beginning VB6 book...

How come I can set an ADODC's properties with...

With Adodc1
.ConnectionString = "Provider= etc..."
.CommandType = adCmdTable
.RecordSource = "Titles"
End With

But I can't create a record set object from the above like:
Private m_recTitles as ADODB.Recordset (In General Declarations)
Set m_recTitles = Adodc1.Recordset (In Form1.Load())

And yet it works if I put the information in manually...?

Bit stumped, would love a pointer in the right direction...

Russ
__________________
Regards

Russ (Programing on L plates..!)
 
Old June 17th, 2003, 03:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

You need to use the data control's Refresh method after setting the control's properties at run time. After you execute the Refresh method, the (new) underlying Recordset will be available via the Recordset property.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
 
Old June 17th, 2003, 03:36 PM
Authorized User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Jeff

I tried this:

With Adodc1
.ConnectionString = "Provider= etc..."
.CommandType = adCmdTable
.RecordSource = "Titles"
.Refresh
End With

But it still doesn't work. Am I doing this correctly? I've put the With statement in the Form1.Load() method as well, is that where it should be...?


Regards

Russ
 
Old June 17th, 2003, 04:19 PM
Authorized User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oops...

Having looked at it again I find that in fact I set the ADO properties via a Sub in a module, and yes, you've guessed it... I had the Set before the Call subADO()...

Lesson learnt: read your own code properly...

:-)


Regards

Russ





Similar Threads
Thread Thread Starter Forum Replies Last Post
ADO Data Control Thurston VB.NET 2002/2003 Basics 3 December 6th, 2005 10:38 PM
ADO Data Control kf4rrm VB Databases Basics 2 April 5th, 2005 11:58 AM
ADO Data Control jwilkerson VB Databases Basics 1 September 29th, 2004 10:53 AM
pls hlp!!! Microsoft ADO Data Control not found x2c4u VB Databases Basics 3 September 29th, 2004 09:42 AM
ADO Data Control jwilkerson Beginning VB 6 1 October 21st, 2003 06:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.