Hello,

I'm getting punched here...

I'm using the function below to check if a specific column exist in a Access 2000 mdb table and if not add it by using an alter table statement.
The first half works fine and I have the response.write(Check_existe_coluna("Equipe",session("id"))) showing false or true in case it finds the second parameter (column name).

The problem sits on the second half, whitch keeps giving me incopatible type errors..

The function to check: (working fine)

Function Check_existe_coluna(tab,coluna)
Dim oField
Dim oRecordset
Dim oConn
Dim nameToCheck
Dim nameExists

nameToCheck = cstr(coluna)
nameExists = false

Set oConn = Server.CreateObject("ADODB.Connection")
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(data_local)

oConn.Open data_source

Set oRecordset = oConn.Execute("SELECT * FROM "&tab&"")

For Each oField In oRecordset.Fields
If oField.Name = nameToCheck Then
nameExists = true
Exit For
End If
Next
Check_existe_coluna=nameExists
oRecordset.Close()
oConn.Close()
Set oConn = Nothing
Set oRecordset = Nothing
End function

The add column statement (showing incompatible type error):

exist_column=Check_existe_coluna("Equipe",session("id"))
If exist_column=false then

strAdd"ALTER TABLE Equipe ADD COLUMN "&session("id")&" TEXT(25)"
Set AddColumn = Server.CreateObject("ADODB.Recordset")
AddColumn.Open strAdd, objCon