PC Review


Reply
Thread Tools Rate Thread

add field to table

 
 
Judy Ward
Guest
Posts: n/a
 
      27th Feb 2009
I would like to programmatically check to see if a field exists in a table,
and if not, create the field in the table. I must not be searching with the
right key words, because I can't find any help on doing this.

Your help would be appreciated!

Thank you,
Judy
 
Reply With Quote
 
 
 
 
Daniel Pineault
Guest
Posts: n/a
 
      27th Feb 2009
To check for the existance of a table field check out

http://forums.devarticles.com/micros...vba-58559.html

Then to add a new field to a table check out

http://www.eggheadcafe.com/forumarch...st25764605.asp

Another approach can be found at

http://allenbrowne.com/func-DDL.html#CreateTableDDL

Other worthwhile readings on the subject (past posts)

http://www.microsoft.com/office/comm...72-beeb1f81cd9
http://www.microsoft.com/office/comm...a-54f06110260f
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



"Judy Ward" wrote:

> I would like to programmatically check to see if a field exists in a table,
> and if not, create the field in the table. I must not be searching with the
> right key words, because I can't find any help on doing this.
>
> Your help would be appreciated!
>
> Thank you,
> Judy

 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      28th Feb 2009
Loop through the Fields of the Recordset to see if the Name you want exists.

If not, you can add a new one via CreateField(). Example:
http://allenbrowne.com/func-DAO.html#ModifyTableDAO

You can also use DDL to create columns:
http://allenbrowne.com/func-DDL.html#CreateFieldDDL
However, this doesn't let you set some crucial properties such as
AllowZeroLength.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Judy Ward" <(E-Mail Removed)> wrote in message
news:9560C547-025C-45AE-8601-(E-Mail Removed)...
>I would like to programmatically check to see if a field exists in a table,
> and if not, create the field in the table. I must not be searching with
> the
> right key words, because I can't find any help on doing this.
>
> Your help would be appreciated!
>
> Thank you,
> Judy


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2003: Link field in table to key field in same table =?Utf-8?B?TWFybmllIEp1ZWwgU2hhdw==?= Microsoft Access Queries 4 28th Jul 2007 09:28 PM
Field in Table 1 references field in Table 2 -- Compare Unused Rec =?Utf-8?B?YmJhcmttYW4=?= Microsoft Access Queries 3 21st Jun 2007 07:21 PM
Make Table STRING field results in NUMERIC field in table. WHY Phil Microsoft Access Queries 2 23rd Apr 2005 01:01 PM
Create table with field names based on the value of a field in another table. simon_minder@hotmail.com Microsoft Access Database Table Design 5 24th May 2004 02:32 PM
Re: Link field values in one table to field names in a second table? John Vinson Microsoft Access Getting Started 0 10th Mar 2004 05:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:43 PM.