I need someone to help me with VB6 codes to add new columns to already created Access database table at run time.

Secondly, i needed to create a duty rota table that keeps track of staff duties for 365 days. I am a bit confuse as i intended placing the fields (Columns) as the days and the names (rows) to be name of staff but i just noticed that the fields in Access has a limit to the number it can hold per table.

For the first part you need to look up an alter table statement for the second part...

tblStaffDuty
iSDID 'unique ID auto number
iStaffID 'foreign key to staff name table
iDutyID 'foreign key to descriptions of duties table
dDate 'date of duty

Good Luck

You need to use ADOX library

more details here and here.

your database is more important
if u use sql you can use sql lang
or
if u use access you must use adox
u can find it on preferences with name Microsoft ADO ext. 2.8 for DDL and Security

Dim Cat     As New ADOX.Catalog
Dim COL     As New Column

Screen.MousePointer = vbHourglass

Cat.ActiveConnection = Cnn.ConnectionString 'Cnn String

With Cat.Tables("Task") 'The Table Name
        Set COL = New Column
        COL.Attributes = adColFixed
        COL.Name = "fldTaskLength"
        COL.Type = adInteger
        .Columns.Append COL
End With

Set COL = Nothing
Set Cat = Nothing

HI guys
iam michael from Tanzania , Iam an IT student (2ndyear),I still dont know to write codes in vb6.0.please guys help me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.