Check field availability

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

From an Access, I would like to check for a field's availability in a
specific table. How should I go about it?
 
From an Access, I would like to check for a field's availability in a
specific table. How should I go about it?

What's the context?

You could use the Table's Fields collection and trap the error if the
field doesn't exist:

Dim tdf As DAO.Tabledef
Dim db As DAO.Database
Dim fld As Field
On Error GoTo Proc_Error
Set db = CurrentDb
Set tdf = db.Tabledefs("MyTableName")
Set fld = tdf.Fields("TheFieldIWant")
If fld Is Nothing Then
<handle the error>
Else
<do something with it>
End If

John W. Vinson[MVP]
 
Back
Top