-
VB 6.0 ADO and Access
I was wanodering if anyone knew how to check to see if a table exists in an
Access database using VB 6.0 ADO programmatically?
Thanks,
JB
-
Re: VB 6.0 ADO and Access
Try this function:
You will need to set a reference to the 'Microsoft ADO Ext. 2.6 for DDL and
Security' dll (msadox.dll) for this to work.
Function TableExists(ByVal TableName As String, _
DBConnection As ADODB.Connection) As Boolean
Dim Cat As ADOX.Catalog
Dim tmpTable As ADOX.Table
If DBConnection.State <> adStateOpen Then _
Err.Raise 32000, "TableExists", _
"Invalid 'DBConnection'. Must be a valid Open ADO Connection object."
Cat.ActiveConnection = DBConnection
For Each tmpTable In Cat.Tables
If StrComp(tmpTable.Name, TableName, vbTextCompare) Then
TableExists = True
Exit Function
End If
Next tmpTable
End Function
Good luck,
Steve
"Jim Burak" <jim.burak@cevp.com> wrote:
>
>I was wanodering if anyone knew how to check to see if a table exists in
an
>Access database using VB 6.0 ADO programmatically?
>
>Thanks,
>
>JB
-
Re: VB 6.0 ADO and Access
On 28 Jun 2001 06:51:48 -0700, "Jim Burak" <jim.burak@cevp.com> wrote:
¤
¤ I was wanodering if anyone knew how to check to see if a table exists in an
¤ Access database using VB 6.0 ADO programmatically?
¤
¤ Thanks,
¤
¤ JB
A simple SQL statement will work as well:
SELECT MSysObjects.*
FROM MSysObjects
WHERE MSysObjects.Name="Table1"
Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
-
Re: VB 6.0 ADO and Access
"Jim Burak" <jim.burak@cevp.com> wrote:
>
>I was wanodering if anyone knew how to check to see if a table exists in
an
>Access database using VB 6.0 ADO programmatically?
>
>Thanks,
>
>JB
There's a system table, msysobjects you can select out of.
Take a look at it.
I think attached tables have a different type to local ones.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks