Do fields exist

jl39775

Registered User.
Local time
Today, 04:53
Joined
Dec 12, 2001
Messages
43
I posted this on Modules & and VBA but maybe someone can help me here.

Is there a way to check if certain fields exist in a table using SQL. I want to add three fields if they don't exist after I import the table from an excel spreadsheet.

Thanks in advance,

James
 
Ok I solved my problem. If anyone wants to know how I got the field names from a table look below.

Thanks,

James

Dim MYdb As ADODB.Connection
Dim MYrs As New ADODB.Recordset
Dim fld As ADODB.Field
Dim sql As String

Set MYdb = CurrentProject.Connection

sql = "select * from adSubcontractAccruals200208"

MYrs.Open sql, MYdb

For Each fld In MYrs.Fields
MsgBox fld.Name
Next
 

Users who are viewing this thread

Back
Top Bottom