By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,816 Members | 2,151 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,816 IT Pros & Developers. It's quick & easy.

Find if a certain field exists in a certain table

P: n/a
I am looking for code that will check if a field (fieldname) exists in a
certain table (tablename), then to add it if it does not. Can anyone guide
me in the right direction. I think I can add the field, but I need to know
how to find if the field is already there.

TIA
dixie
Aug 8 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Dixie wrote:
I am looking for code that will check if a field (fieldname) exists
in a certain table (tablename), then to add it if it does not. Can
anyone guide me in the right direction. I think I can add the field,
but I need to know how to find if the field is already there.

TIA
dixie
CurrentDB.TableDefs("TableName").Fields("FieldName ").Name

Will return the name of the field if it exists or raise an error if it doesn't.
You can either loop through all fields testing for the name you are looking for
or just do the above and trap for the error.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Aug 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.