I have no experience using modules or vb with an access database, so I need some help.
I have a make table query. When the new table is created, I need to include an autonumber field. I have spent most of the morning searching this forum for a solution. One solution is to run the make query as is. After the table is created, then run code that inserts a new column field into the table which has the attributes of an autonumber field. I found this code but do not know where to paste into the database and make it run. I appreciate any responses to help solve this problem
dim db as dao.database
dim sql as string
dim stbl as string
dim sfld as string
stbl="tbl_part_number_data"
sfld ="fld_auto_id"
Set db = CurrentDb
sql = "ALTER TABLE " & stbl & " ADD COLUMN " & sfld & " AUTOINCREMENT"
db.Execute sql
Jeff
I have a make table query. When the new table is created, I need to include an autonumber field. I have spent most of the morning searching this forum for a solution. One solution is to run the make query as is. After the table is created, then run code that inserts a new column field into the table which has the attributes of an autonumber field. I found this code but do not know where to paste into the database and make it run. I appreciate any responses to help solve this problem
dim db as dao.database
dim sql as string
dim stbl as string
dim sfld as string
stbl="tbl_part_number_data"
sfld ="fld_auto_id"
Set db = CurrentDb
sql = "ALTER TABLE " & stbl & " ADD COLUMN " & sfld & " AUTOINCREMENT"
db.Execute sql
Jeff