asked on
if bready=false and resbutlefstr="" and reskeymid<>27 and resbutmidstr<>"cancel" then
'=== all value were validated, we continue
dbnam = dbnam & ".mdb"
'=== chek if the file already exist
Set objFolder2 = objFSO.GetFolder(basedir)'=== dir
Set objFiles2 = objFolder2.files '=== fichiers
found=0
For Each objFile3 in objFiles2
nomfile=objfile3.name
nomfile=lcase(nomfile)
if nomfile=dbnam then
found=1
end if
next
if found=1 then
a = clefra(array("fmid"))
fbot.WriteLn("The file: <br>" & dbnam & "<br>Already exist<br><br>Please use EDIT DATABASE to manage it<br><br>")
fbot.WriteLn("FIN<br><br>")
fbot.WriteLn("LIST of table in the existing database:<br><br>")
Set objcat = CreateObject("ADOX.Catalog")
Set objcon = CreateObject("ADODB.Connection")
constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbnam
objcon.open constr
objcat.activeconnection=(objcon)
for each tab in objcat.Tables
If tab.Type = "TABLE" Then
fbot.WriteLn("<br>TABLES:<br><br>")
fbot.WriteLn(tab.name & "<br>")
fbot.WriteLn("<br>COLUMNS:<br><br>")
for each col in tab.columns
c = lcase(col.name)
fbot.WriteLn(c & "<br>Type: " & col.type & "   Autoincrement: " & col.Properties("AutoIncrement") & "<br>")
next
end if
next
objcon.close
set objcat=nothing
set objcon=nothing
else
a = clefra(array("fmid"))
'=== formats: jet10 = 1 Jet11 = 2 Jet20 = 3 Jet3x = 4 Jet4x = 5 (Access 2000)
Dim Catalog
fbot.WriteLn("Creation ADOX catalog (adox.dll, access required)<br><br>")
Set objcat = CreateObject("ADOX.Catalog")
format = 5
fbot.WriteLn("database creation: " & dbnam & "<br><br>")
constr="Provider=Microsoft.Jet.OLEDB.4.0;" & "Jet OLEDB:Engine Type=" & Format & ";Data Source=" & dbnam
objcat.Create constr
'=== add a table in the database
fbot.WriteLn("table creation: " & tabnam &"<br>")
Set objtab = CreateObject("ADOX.table")
objtab.name = tabnam
objcat.Tables.Append objtab
objcat.Tables.refresh
'=== add a columns in the only existing table
for each tab in objcat.Tables
If tab.Type = "TABLE" Then
fbot.WriteLn("table existing: " & tab.name & "<br>")
'=== add column in database
Set objcol = Nothing
colnam="codintsef"
a=crecol(tab,colnam)
fbot.WriteLn("primary key creation: " & colnam & "<br>")
Set objkey = CreateObject("ADOX.key")
objkey.name="Primary"
objkey.columns.append colnam
tab.keys.append objkey
'Set aIndex = New ADOX.Index
'aIndex.Name = "ByField2"
'aIndex.Clustered = False
'aIndex.Columns.Append "Field2"
'aIndex.Columns.Append "Field1"
'aTable.Indexes.Append aIndex ' save the index
for each col in tab.columns
c = lcase(col.name)
fbot.WriteLn("column existing: " & c & "   autoincrement status: " & objcol.Properties("AutoIncrement") & "<br>")
next
end if
next
set objcat=nothing
fbot.WriteLn("<br>You database have been created with 1 table and a defaut column named " & colnam & "<br>")
fbot.WriteLn("<br>END<br>")
ASKER
ASKER
ASKER
Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.
TRUSTED BY
ASKER