I snagged a code source sample for something that may be of help to you. could even work over foxpro but I wouldnt know havnt done anything in it (yet)
this may give you some ideas to the same thing I described but in pure VB / ADO instead...
If you need the entire thing you can get it form http://www.planet-source-code.com search teh VB direcotries for
.. ADO MS Access it applies to a lot mroe though.. or write the author directly at the following info
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Database Tutorial v1.0
'Dustin Davis
'VB Live
'http://www.vblive.com
'
'This tutorial is to show you how to talk to databases with pure code
'no data object. This comes in handy for ASP applications or DHTML projects
'
'You will need a reference to DAO 3.6 (only if you use access 2000)
'and if you dont have it, get the service pack 3 from microsoft.com
'If you use access 98 or lower, you can use DAO 3.5
'
'Questions or comments, please send em to [email protected]
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function Add_Table()
'This function will show how to delete records
'Dim our variables
Dim DB As Database
Dim WS As Workspace
Dim TD As TableDef
Dim FD1 As Field
Dim FD2 As Field
Dim FD3 As Field
'This sets a workspace for the database
Set WS = DBEngine.Workspaces(0)
'this opens the database
Set DB = WS.OpenDatabase(App.Path & "\dbtut.mdb")
'Set the table info
Set TD = DB.CreateTableDef(Text5.Text)
'create new fields and bind it to the table.
'For the dbText, you can use dbInteger or whatever else
'you wish to set the field type to. I would stick with those
'2 though.
Set FD1 = TD.CreateField(Text6.Text, dbText)
Set FD2 = TD.CreateField(Text7.Text, dbText)
Set FD3 = TD.CreateField(Text8.Text, dbText)
'bind the Fields to the table
TD.Fields.Append FD1
TD.Fields.Append FD2
TD.Fields.Append FD3
'Now bind the table to the database
DB.TableDefs.Append TD
'close the database
DB.Close
End Function
Public Function Delete_Table()
'This function will show how to delete records
'Dim our variables
Dim DB As Database
Dim WS As Workspace
Dim TD As TableDef
Dim FD As Field
'This sets a workspace for the database
Set WS = DBEngine.Workspaces(0)
'this opens the database
Set DB = WS.OpenDatabase(App.Path & "\dbtut.mdb")
'Set the table to open
DB.TableDefs.Delete Text5.Text
'close the database
DB.Close
End Function
Enter your message below
Sign in or Join us (it's free).