Question : How to get an auto incremented value in the primary key column in ms-access?

Hi,
I need to insert values into a table by selecting the values from another table as follows.

Insert into tbl1 (FieldID, TranID, Name)
Select "F1_" &  , TransactionID, Name from tbl2

The column "FieldID" in table "tbl1" is defined as primary key so I need to insert an unique value for that.
How can I generate an unique value while doing insert and append that unique value with a string constant "F1_" for each record.
Thanks for any help.

Answer : How to get an auto incremented value in the primary key column in ms-access?

I am afraid but that is not possible....
You can write a code to do that though
E.g. Something like....
Insert into tbl1 (FieldID, TranID, Name)
Select "F1_" & (Select mid(max(FieldID),4,4) + 1 from tbl1 where FieldID like "F1_")  , TransactionID, Name from tbl2 Where TransactionID = "Tran1"

You would need data conversion etal. Though, better would be to add another field that describes F1, D1 and autonumber field kept without any formatting.
Random Solutions  
 
programming4us programming4us