Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query into Table 1

Status
Not open for further replies.

cunla

Programmer
Nov 9, 2004
2
IL
I am having a problem, I want to build a table from a table. I use "SELECT ... INTO ... FROM ..." and there is no problem, but the new table doesnt have a PK, how do I add an autonumber field to the Query? and ofcourse, make it PK? so that the relations are kept?
 
A new table wouldn't have any relations that I am aware of. The only way that I am aware of creating an Autonumber field in a make table query is by including an Autonumber field in the select.

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
DoCmd.RunSQL "ALTER TABLE yourTable ADD COLUMN myID COUNTER(1,1) CONSTRAINT myPK PRIMARY KEY"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top