hi i am developing a visual basic application with (vb6.0)and have the following questions,1. how will i add a table in my application and then use one column to be getting data from another table. 2. can i make a query in .mdb and then run it in visual basic.how will i do it if its possible, i have connected to my database (using data environment)and i cant navigate the records.
Software/Hardware used:
ASKED:
March 21, 2009 11:11 AM
UPDATED:
March 25, 2009 2:06 AM
In general, this is how you create a database in code:
'Define some variables: Dim CatDBTest As Database Dim CatDBTableDefCategory As TableDef Dim CatIdx As Index Dim msgCancel As String Set CatDBTest = CreateDatabase({catalog name}, dbLangGeneral) 'create the actual MDB file 'Create a table: Set CatDBTableDefCategory = CatDBTest.CreateTableDef("Category") With CatDBTableDefCategory .Fields.Append .CreateField("Category", dbText) End With CatDBTest.TableDefs.Append CatDBTableDefCategory 'Create a key: With CatDBTableDefCategory Set CatIdx = .CreateIndex("Key") CatIdx.Fields.Append CatIdx.CreateField("Category") CatIdx.Primary = True .Indexes.Append CatIdx .Indexes.Refresh End WithThat should be enough to get you started.
As for queries, it is easier to create the query in VB and run it using SQL. (IMHO)