G
Guest
I have a form in an adp project that opens to a new record in tblTransaction,
which has an identity TransactionID field as its key field. There are a
number of fields for the user to fill out that are saved as fields in
tblTransaction, and an unbound combo box from which the user selects an item,
then clicks the "Add item" button.
The Add Item button is supposed to add a related record to
tblTransactionLineItem with its foreign key, TransactionID, set to the ID of
the new record in tblTransaction, then display the new record in a list box.
I have been unable to grab the new TransactionID to use in my insert. My
code is as follows:
If Not IsNull(Me.cboSelectBarCode) Then
Me.Refresh
sql = "execute uspNewItem " & me.cboSelectBarCode & ", " &
me.TransactionID
...
I get an "Invalid Use of Null" error when trying to evaluate
me.TransactionID. When I try replacing Me.Refresh with Me.Recordset.Update,
I get runtime error 3021 "Either BOF or EOF is True, or the current record
has been deleted."
How can I force the form to save the current new record without closing and
then get the value of the identity field?
which has an identity TransactionID field as its key field. There are a
number of fields for the user to fill out that are saved as fields in
tblTransaction, and an unbound combo box from which the user selects an item,
then clicks the "Add item" button.
The Add Item button is supposed to add a related record to
tblTransactionLineItem with its foreign key, TransactionID, set to the ID of
the new record in tblTransaction, then display the new record in a list box.
I have been unable to grab the new TransactionID to use in my insert. My
code is as follows:
If Not IsNull(Me.cboSelectBarCode) Then
Me.Refresh
sql = "execute uspNewItem " & me.cboSelectBarCode & ", " &
me.TransactionID
...
I get an "Invalid Use of Null" error when trying to evaluate
me.TransactionID. When I try replacing Me.Refresh with Me.Recordset.Update,
I get runtime error 3021 "Either BOF or EOF is True, or the current record
has been deleted."
How can I force the form to save the current new record without closing and
then get the value of the identity field?