Verify field name

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

Hi folks,

I need a help to verify the field name of a table. A
table named tbltest in my database. I need some code to
check that the second field name equal to “f2” or not. If
not, error message.

Any help will be great appreciated.

Thanks in advance.

Tim.
 
Sub CheckField()
If CurrentDb.TableDefs("tbltest").Fields(1).Name = "f2" Then
MsgBox "The second field is correct"
Else
MsgBox "The second field is incorrect"
End If
End Sub

Note: 1 = 2 when you count from 0 ;)
 
medialint,

The code works great.

Thanks.

Tim.
-----Original Message-----
Sub CheckField()
If CurrentDb.TableDefs("tbltest").Fields(1).Name = "f2" Then
MsgBox "The second field is correct"
Else
MsgBox "The second field is incorrect"
End If
End Sub

Note: 1 = 2 when you count from 0 ;)


.
 
Back
Top