It's been over 20 years since I needed to add a table from VB6 code. I found some articles on how to do it but I'm missing something.
Ok so the program does the following
1. enter the name of the new table in a txt box - in form_load
2. Open the database using DAO - from form_load calls OpenDatabase procedure
3. Add the new table - from form_load calls the AddTable procedure
4. Close the database - from form_load calls the CloseDatabase Procedure.
In AddTable, here's the beginning code
Code:
Private Sub AddTable(sCategory As String)'Purpose: Create a table using DAO.
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
'Initialize the Contractor table.
Set db = CurrentDb
Set tdf = db.CreateTableDef("tbl" & sCategory)
I can't get past the Set db statement. shown in red. I am not sure what I need.
Thanks