PC Review


Reply
Thread Tools Rate Thread

Createfield - nominiating position

 
 
Andrew
Guest
Posts: n/a
 
      13th Aug 2008
Hi,

I'm using the folowing method to insert a column. It inserts 'Col_D' after
the very last column ('Col_F'). How do I get it to insert it after the third
existing column. The name of the column is 'Col_D' and the table goes up to
'Col_F'.

Set tdfNew = myDB.TableDefs("Test")
tdfNew.Fields.Append tdfNew.CreateField("Col_D", dbText)

Andrew
130808

--
Andrew
 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      13th Aug 2008
"Andrew" <(E-Mail Removed)> wrote in message
news:71E94C35-7030-4EAB-AC5B-(E-Mail Removed)...
> Hi,
>
> I'm using the folowing method to insert a column. It inserts 'Col_D'
> after
> the very last column ('Col_F'). How do I get it to insert it after the
> third
> existing column. The name of the column is 'Col_D' and the table goes up
> to
> 'Col_F'.
>
> Set tdfNew = myDB.TableDefs("Test")
> tdfNew.Fields.Append tdfNew.CreateField("Col_D", dbText)



After creating and appending the field, try:

tdfNew.Fields("Col_D").OrdinalPosition = 3
tdfNew.Fields("Col_E").OrdinalPosition = 4
tdfNew.Fields("Col_F").OrdinalPosition = 5


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
Tom van Stiphout
Guest
Posts: n/a
 
      13th Aug 2008
On Tue, 12 Aug 2008 20:09:01 -0700, Andrew
<(E-Mail Removed)> wrote:

New fields are added at the end. You have to go out of your way to
affect the position. Fortunately there really is no reason for
worrying about position, because you would typically not use the raw
tables, but instead use queries where you can re-order the fields if
you like.

-Tom.
Microsoft Access MVP


>Hi,
>
>I'm using the folowing method to insert a column. It inserts 'Col_D' after
>the very last column ('Col_F'). How do I get it to insert it after the third
>existing column. The name of the column is 'Col_D' and the table goes up to
>'Col_F'.
>
> Set tdfNew = myDB.TableDefs("Test")
> tdfNew.Fields.Append tdfNew.CreateField("Col_D", dbText)
>
>Andrew
>130808

 
Reply With Quote
 
Andrew
Guest
Posts: n/a
 
      13th Aug 2008
Thanks Tom.

I knew about the order facility in queries but this is just me being
pedantic. Dirk Goldgar was able to assist and it works a treat!

Thanks again.
--
Andrew


"Tom van Stiphout" wrote:

> On Tue, 12 Aug 2008 20:09:01 -0700, Andrew
> <(E-Mail Removed)> wrote:
>
> New fields are added at the end. You have to go out of your way to
> affect the position. Fortunately there really is no reason for
> worrying about position, because you would typically not use the raw
> tables, but instead use queries where you can re-order the fields if
> you like.
>
> -Tom.
> Microsoft Access MVP
>
>
> >Hi,
> >
> >I'm using the folowing method to insert a column. It inserts 'Col_D' after
> >the very last column ('Col_F'). How do I get it to insert it after the third
> >existing column. The name of the column is 'Col_D' and the table goes up to
> >'Col_F'.
> >
> > Set tdfNew = myDB.TableDefs("Test")
> > tdfNew.Fields.Append tdfNew.CreateField("Col_D", dbText)
> >
> >Andrew
> >130808

>

 
Reply With Quote
 
Chris O''''Neill
Guest
Posts: n/a
 
      14th Aug 2008

"Andrew" wrote:

> Thanks Tom.
>
> I knew about the order facility in queries but this is just me being
> pedantic. Dirk Goldgar was able to assist and it works a treat!


I thought *I* was the only pedantic person around here!

Regards, Chris

 
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
CreateField =?Utf-8?B?TWlrZSBD?= Microsoft Access VBA Modules 1 14th Feb 2007 08:23 PM
CreateField Lasse T Microsoft Access Database Table Design 1 6th Mar 2006 01:25 PM
Re:CreateField David Kennedy Microsoft Access Form Coding 1 24th Nov 2004 03:12 AM
CreateField David Kennedy Microsoft Access Form Coding 2 23rd Nov 2004 04:21 PM
CreateField Ray Hogan Microsoft Access Getting Started 1 23rd Jul 2004 10:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:43 AM.