ordinalposition help

K

kriti

Hi,
I'm adding 2 new fields to an already existing table in access. I need to
relocate them into the first and second columns of the table. I'm using the
ordinalposition property, but it's acting a little weird. To get them in the
manner I described (the first and second columns), I have to set both
ordinalpositions to 1. Isn't that not right? Shouldn't I be setting the first
field to an ordinal position of 1, and the second field to an ordinalposition
of 2? (Yes, I am defining, creating and appending the new fields in the right
order). Any clarification on this would be greatly appreciated.
Thank you,
Kriti
 
D

Douglas J Steele

OrdinalPosition starts at 0, not 1, so you'd really want to be setting them
to 0 and 1, not 1 and 2.
 
K

kriti

Hi Dougals,
That's what I thought too, but I'm doing 1 and 1 both times, and it's
working. Not sure why. Any ideas?
Thanks,
Kriti
 
D

Douglas J. Steele

Sorry, no idea. However, it's very unusual to have to programmatically add
fields. Not only that, but the position in the table should be immaterial:
if there's really a need for a specific order, you can always create a query
that has the fields in the prescribed order, and use the query rather than
the table.
 
K

kriti

Hi Douglas, You're quite right. But I'm using VBA to generate a bunch of
reports off a certain file in my database, and because of large sizes, i want
to avoid having fixed tables in the database the whole time. Therefore I have
a template table, with no records, which usually serves the purpose. For 2 of
the reports, however, a couple of extra fields need to be added to it. That's
the reason I'm using this method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top