>Hi everyone!
>
>I am looking for ability to get New ID which will be automatically assigned to my identity setup field, before I insert record.
>basically I need to attach this field to some expression and build it into INSERT command, to provide it to another field.
>
>For example
>
>cStroka = _
>"INSERT INTO mOpt (objectname) VALUES ("& MakePrefix() & [new id] &")"
>objCommand.CommandText =cStroka
>objCommand.Execute
Identitiy fields are not assigned values until a record is actually inserted. There is a field in the one of the system tables you could query to get the next number but you aren't guarenteed that number so it's really useless.
Insert your record and then immediately issue a SELECT @@Identity as 'SomeFieldName'. You can then use this value to update any associated records you may have.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao