Wrox Programmer Forums
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases 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 3rd, 2004, 05:09 AM
Authorized User
 
Join Date: Jun 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default System Objects in Jet

Hi

I'm creating some tables using the following code, but for some reason when I view the tables in Access they appear as System tables (the table names do not start MSys or USys). Any Ideas?

Thanks

Code foillows:


    'Batch Table ************************************************** *************
    Set rstFieldDefs = dbsJobs.OpenRecordset(frmInitialise.txtJobName, dbOpenDynaset)
    Set tdfBatchTable = dbsBatch.CreateTableDef(strBatchTableName, dbOpenDynaset)
    ' Create batch if doesn't exist.
    On Error Resume Next
    Set rstBatch = dbsBatch.OpenRecordset(strBatchTableName, dbOpenDynaset)
    If Err.Number = 3078 Then
        'Create Field Definitions
        rstFieldDefs.MoveFirst
        With tdfBatchTable
            Do Until rstFieldDefs.EOF
                Set fldTemp = .CreateField(rstFieldDefs.Fields("Field Name"), dbText)
                fldTemp.AllowZeroLength = True
                .Fields.Append fldTemp
                rstFieldDefs.MoveNext
            Loop
        End With
        dbsBatch.TableDefs.Append tdfBatchTable
        Set rstBatch = dbsBatch.OpenRecordset(strBatchTableName, dbOpenDynaset)
    End If

Thanks
Psionmane
__________________
Thanks
Psionman
 
Old June 3rd, 2004, 09:30 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

from MSDN


Set tabledef = database.CreateTableDef (name, attributes, source, connect)

The CreateTableDef method syntax has these parts.

Part Description
tabledef An object variable that represents the TableDef object you want to create.
database An object variable that represents the Database object you want to use to create the new TableDef object.
name Optional. A Variant (String subtype) that uniquely names the new TableDef object. See the Name property for details on valid TableDef names.
attributes Optional. A constant or combination of constants that indicates one or more characteristics of the new TableDef object. See the Attributes property for more information.
source Optional. A Variant (String subtype) containing the name of a table in an external database that is the original source of the data. The source string becomes the SourceTableName property setting of the new TableDef object.
connect Optional. A Variant (String subtype) containing information about the source of an open database, a database used in a pass-through query, or a linked table. See the Connect property for more information about valid connection strings.


also attributes has this constanst...


For a TableDef object, the value specifies characteristics of the table represented by the TableDef object and can be a combination of these Long constants.

Constant Description
dbAttachExclusive For databases that use the Microsoft Jet database engine, the table is a linked table opened for exclusive use. You can set this constant on an appended TableDef object for a local table, but not on a remote table.
dbAttachSavePWD For databases that use the Microsoft Jet database engine, the user ID and password for the remotely linked table are saved with the connection information. You can set this constant on an appended TableDef object for a remote table, but not on a local table.
dbSystemObject The table is a system table provided by the Microsoft Jet database engine. You can set this constant on an appended TableDef object.
dbHiddenObject The table is a hidden table provided by the Microsoft Jet database engine. You can set this constant on an appended TableDef object.
dbAttachedTable The table is a linked table from a non-ODBC data source such as a Microsoft Jet or Paradox database (read-only).
dbAttachedODBC The table is a linked table from an ODBC data source, such as Microsoft SQL Server (read-only).


i bet that dbopendynaset has the same value or includes the value of a system table... ;)




HTH

Gonzalo
 
Old June 4th, 2004, 03:04 AM
Authorized User
 
Join Date: Jun 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Muchas gracias Gonzalo, pero todavia hay problemas:

I've not been able to find much about system objects on MSDN - just that you create them by naming them 'USys....'

As far as I can see there are no options you can set that creates system objects

The code used to work and to create normal tables: but something somewhere (maybe not in this fragment) changed and now they are system objects :( ... maybe the way the database is opened (?)






Thanks
Psionman
 
Old June 4th, 2004, 08:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

De nada :)

did you try change dbopendynaset for another constant??
try to create it with no swichts...

HTH

Gonzalo





Similar Threads
Thread Thread Starter Forum Replies Last Post
Linq and namespaces System and System.Xml roman BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 July 4th, 2008 01:15 PM
System.InvalidCastException; System.Reflection.Tar Jophie BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 January 16th, 2008 03:29 PM
Insert System date and System Time -Form _TextBox cnkumar74 VB How-To 14 February 14th, 2007 10:52 AM
File system Objects and IIS 6.0 jfergy Classic ASP Components 0 March 5th, 2006 06:11 PM
Casting System::Object __gc * to System.Double[] nepsat Visual C++ 3 November 19th, 2005 12:51 PM





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