Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics 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 May 11th, 2006, 05:15 AM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to convert this DAO connection code to ADO Con

mNode.Text = "Tables"
mNode.Tag = DB.Name
mNode.Image = "Folder"
tvDatabase.LabelEdit = tvwManual

PBar(0).Visible = True
PBar(0).Max = DB.TableDefs.Count - 1
For A = 0 To DB.TableDefs.Count - 1
PBar(0).Value = A
If Left(DB.TableDefs(A).Name, 4) <> "MSys" Then
Set mNode = tvDatabase.Nodes.Add(1, tvwChild, , DB.TableDefs(A).Name, "Table")
mNode.Tag = "Tables"
TableIndex = mNode.Index
Set RS = DB.OpenRecordset(DB.TableDefs(A).Name)
For B = 0 To RS.Fields.Count - 1
If RS.Fields(B).Name <> "ID" Then
Set mNode = tvDatabase.Nodes.Add(TableIndex, tvwChild)
GoSub FixType
If RS.Fields(B).Type = dbBoolean Or RS.Fields(B).Type = dbMemo Then
mNode.Text = RS.Fields(B).Name & Space(25 - Len(RS.Fields(B).Name) + 5) & FieldType
Else
mNode.Text = RS.Fields(B).Name & Space(25 - Len(RS.Fields(B).Name) + 5) & FieldType & Space(8 - Len(FieldType) + 5) & RS.Fields(B).Size
End If
mNode.Tag = "Fields"
FieldsIndex = mNode.Index
End If
Next B
End If
Next A

DoEvents
PBar(0).Visible = False
For I = 1 To tvDatabase.Nodes.Count - 1
tvDatabase.Nodes(I).Sorted = True
Next I
Screen.MousePointer = 0
tvDatabase.Nodes(1).Expanded = True
'tvDatabase.SetFocus
SendKeys "{HOME}", True
Exit Sub






Similar Threads
Thread Thread Starter Forum Replies Last Post
Using DAO and ADO within ADODB.connection faridrd Access VBA 0 January 8th, 2008 10:43 PM
how to translate a code in DAO to ADO itsmenow Access VBA 2 July 7th, 2005 09:19 AM
Convert ADO connection to DAO database dr_morose Access VBA 0 November 17th, 2004 05:44 PM
Convert ADO reocordset to DAO recordset use report redd Access 1 September 24th, 2004 03:34 PM
converting DAO code to ADO Khalifeh Access 25 November 4th, 2003 01:22 PM





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