generallyconfused
Technical User
Hello all,
It is possible to change an autonumber fields datatype to a number (long integer) via the access gui under table design.
My question is how would I do the same thing via vba code, preferably with ADO, to a dbase that is not open. I was thinking of something like this.....
First off, this code assumes there is a access dbase at C:\Temp.mdb that contains a table named "Test" that has the first field set as an autonumber.
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Temp.mdb;"
conn.Open
rs.Open "Test", conn
rs.Fields(0).Type = adBigInt
rs.Update
rs.Close
conn.Close
It doesn't work though, but I hope you guys get the gist of what I'm attempting. The type property seems to be read only. I figure there must be a way to do it since it can be done through the gui.
Thanks,
GC
It is possible to change an autonumber fields datatype to a number (long integer) via the access gui under table design.
My question is how would I do the same thing via vba code, preferably with ADO, to a dbase that is not open. I was thinking of something like this.....
First off, this code assumes there is a access dbase at C:\Temp.mdb that contains a table named "Test" that has the first field set as an autonumber.
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Temp.mdb;"
conn.Open
rs.Open "Test", conn
rs.Fields(0).Type = adBigInt
rs.Update
rs.Close
conn.Close
It doesn't work though, but I hope you guys get the gist of what I'm attempting. The type property seems to be read only. I figure there must be a way to do it since it can be done through the gui.
Thanks,
GC