Key a field in a macro - Change Field Properties in a Macro

G

Guest

Is it at all possible to key a field in a macro? Specifically, I want to key
the first three fields a table as a step in my macro.

Also, is it possible to change the "Field Size" of a text field using a macro?

Thanks.
 
S

Steve Schapel

You can use a RunSQL action in your macro to run a query like this...
ALTER TABLE [YourTable] ALTER COLUMN [YourField] TEXT(100)

I don't understand what you mean by "to key a field".
 
G

Guest

Hi Steve,

When I say "to key a field", I mean the equivalent of highlighting a field
(or two, or three fields), right clicking and selecting Primary Key. I guess
Keying a field is old-school Corel Paradox language, which is what we're
migrating from. Basically I want my first three fields together to all be
primary keys. It works to do the highlight-right-click manoeuver, but I'd
like to have a macro do it instead. Thanks again for your response.

Steve Schapel said:
You can use a RunSQL action in your macro to run a query like this...
ALTER TABLE [YourTable] ALTER COLUMN [YourField] TEXT(100)

I don't understand what you mean by "to key a field".

--
Steve Schapel, Microsoft Access MVP
Is it at all possible to key a field in a macro? Specifically, I want to key
the first three fields a table as a step in my macro.

Also, is it possible to change the "Field Size" of a text field using a macro?

Thanks.
 
D

Douglas J. Steele

You'd be best off learning VBA, rather than relying on macros. It's
relatively simple to do what you're trying to do using either DAO or ADOX.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


JornyO said:
Hi Steve,

When I say "to key a field", I mean the equivalent of highlighting a field
(or two, or three fields), right clicking and selecting Primary Key. I
guess
Keying a field is old-school Corel Paradox language, which is what we're
migrating from. Basically I want my first three fields together to all be
primary keys. It works to do the highlight-right-click manoeuver, but I'd
like to have a macro do it instead. Thanks again for your response.

Steve Schapel said:
You can use a RunSQL action in your macro to run a query like this...
ALTER TABLE [YourTable] ALTER COLUMN [YourField] TEXT(100)

I don't understand what you mean by "to key a field".

--
Steve Schapel, Microsoft Access MVP
Is it at all possible to key a field in a macro? Specifically, I want
to key
the first three fields a table as a step in my macro.

Also, is it possible to change the "Field Size" of a text field using a
macro?

Thanks.
 

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