VB ADO controls in VBA

VB ADO controls in VBA

Anonymous
Not applicable
395 Views
4 Replies
Message 1 of 5

VB ADO controls in VBA

Anonymous
Not applicable
I try to write simple code that use Access database in Acad VBA using MS ADO
Data control and Data List control.
But I can't set RowSource property for Data List control because there is no
RowSource properties in Properties window.
Tried to set it in code with DataList1.RowSource="adodc1" but it didn't
work.

Any suggestion, please?
0 Likes
396 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
I had a similar problem when I started using ADO 2.1 in A2000 VBA (V5). I
worked around it by getting rid of the ADO data control, doing the ADO
connection, command, and recordset objects with code, and binding the
recordset to the ACAD VBA form controls through the MS BindingCollection
Object. Using the BindingCollection allows ordinary, native ACAD VBA5
(non-data-aware) form controls to be bound to the recordset. This approach
has proved solid and reasonably easy to maintain, though it is a bit slow.
--
John Goodfellow
irtf'nm
use 'microtouch' in address to email

"Tometa" wrote in message
news:CA7F7EB72A50D2D13BEBE3E57C7A93E7@in.WebX.maYIadrTaRb...
> I try to write simple code that use Access database in Acad VBA using MS
ADO
> Data control and Data List control.
> But I can't set RowSource property for Data List control because there is
no
> RowSource properties in Properties window.
> Tried to set it in code with DataList1.RowSource="adodc1" but it didn't
> work.
>
> Any suggestion, please?
>
0 Likes
Message 3 of 5

Anonymous
Not applicable
Something similar to (watch word wrap):

Me.adoDefaults.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";Data
Source=C:\Temp\Test.mdb;Persist Security Info=False"
Me.adoDefaults.RecordSource = "SELECT * FROM Defaults"
Me.adoDefaults.Refresh

Set Me.lstDefaults.DataSource = adoDefaults
Me.lstDefaults.DataField = "LocationID"
Me.lstDefaults.ListField = "City"
Set Me.lstDefaults.RowSource = adoLocation

I found the key was to issue a refresh on the ADO Data control and use Set
on the RowSource for the Data List control.

--
http://www.acadx.com
Win a free autographed copy of
"AutoCAD 2000 VBA Programmer's Reference"
by Joe Sutphin

"Tometa" wrote in message
news:CA7F7EB72A50D2D13BEBE3E57C7A93E7@in.WebX.maYIadrTaRb...
| I try to write simple code that use Access database in Acad VBA using MS
ADO
| Data control and Data List control.
| But I can't set RowSource property for Data List control because there is
no
| RowSource properties in Properties window.
| Tried to set it in code with DataList1.RowSource="adodc1" but it didn't
| work.
|
| Any suggestion, please?
|
0 Likes
Message 4 of 5

Anonymous
Not applicable
> Set Me.lstDefaults.DataSource = adoDefaults

It halts on upper line with message: "Method or data member not found".
I put one MS ADO Data Control 6.0 (sp4) (OLEDB) and one MS Data List Control
6.0 (sp4) (OLEDB) on form.
Can you may be direct me where do I go wrong?

Thanks!
0 Likes
Message 5 of 5

Anonymous
Not applicable
Did you assign a reference to Microsoft's ActiveX Data Objects Library?

--
http://www.acadx.com
Win a free autographed copy of
"Mastering AutoCAD 2000 Objects"
by Dietmar Rudolph

"Tometa" wrote in message
news:22947EB7522E12B033EA1FC16A4C6536@in.WebX.maYIadrTaRb...
| > Set Me.lstDefaults.DataSource = adoDefaults
|
| It halts on upper line with message: "Method or data member not found".
| I put one MS ADO Data Control 6.0 (sp4) (OLEDB) and one MS Data List
Control
| 6.0 (sp4) (OLEDB) on form.
| Can you may be direct me where do I go wrong?
|
| Thanks!
|
0 Likes