Hello,

Please help.

I need to add new field in MS Access table. Please see my code below.

If Field does not exist create a new one.

Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
Dim ssql As String
Dim tbl As String
Dim ID As Integer
Dim DBFullName As String
Dim UN As String
Dim CheckUN As Variant

UN = Environ("username")
DBFullName = "C:\File.accdb"


cn.Open "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & DBFullName & ";"
                
Set rs = CreateObject("ADODB.Recordset")
rs.Open "Table1", cn, adOpenKeyset, adLockOptimistic, adCmdTable

On Error Resume Next
Set CheckUN = rs.Fields(UN)
If CheckUN Is Nothing Then

    'MS Access add field
    
End If
On Error GoTo 0

Set rs = Nothing
cn.Close
Set cn = Nothing
Thanks in advance.