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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top