Update Field Data Type

M

Manuel

I have a checkbox field for which I want to change the data type to a Number
(Integer or Long Integer).

I searched the discussion board and found the following suggested code:

Dim strSql As String

strSql = "ALTER TABLE MyTable ALTER MyField LONG;"
DBEngine(0)(0).Execute strSql, dbFailOnError

I ran the code and while it does successfully change the data type to LONG
INTEGER, the Display Control property remains set at 106 (Check Box) and
therefore the appearance of the field in datasheet view does not change.

Could someone let me know how I would go about changing the Data Control
property (and other field properties - might as well ask since I'm posing the
question) for an existing field?

Thanks,
Manuel
 
J

Jack Leach

Allen Browne has some code to do the opposite... I'm sure you can figure it
out from there...

http://allenbrowne.com/NoYesNo.html


particularly this line:

CurrentDb.TableDefs("Table1").Fields("Field1").Properties("DisplayControl")
= CInt(acCheckBox)

if you highlight acCheckBox and hit F1 I would assume the help file will
contain a list of constants for other controls

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
M

Manuel

Thanks! I was able to use the information at the link you provided to
accomplish what I needed.

Now I'd like to be able to set the "Order By" property for a table
programmatically. Ay ideas as to how I would accomplish this?
 

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