|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
can I check if a column already exisits?
How do I check if a table column name exists?
Is this something that can be performed in visual basic? Thanks in advance for any help you can give. |
|
#2
|
|||
|
|||
|
You can use the following function as an example of how to determine if a field name exists in a table.
Function FieldExists() As Boolean Dim db As Database Dim tbl As TableDef Dim fld As Field Dim strName as String Set db = CurrentDb Set tbl = db.TableDefs("NameofTable") strName = "NameOfField" For Each fld In tbl.Fields If fld.Name = strName Then FieldExists = True Exit For End If Next If FieldExists Then MsgBox "Field Name Exists" Else MsgBox "Field Name Does Not Exist" End If db.Close End Function Not sure of where you wanted to call this procedure, so it can be modified to suit your needs. lwells Last edited by lwells : July 11th, 2005 at 01:01 PM. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > can I check if a column already exisits? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|