P
Pete
Re Access 2003 SP2
I'm probably going about this the wrong way, but;
I have a parent form with an 'Add Invoice' button to add a new blank invoice
line for the selected PO to the subform. Previously added Invoices for a PO
are locked.
I want to add a blank record on the subform and stop a another new record
appearing when the user begins to edit the first new (blank) record.
I have tried using:-
With subfrmInvoicesReceived.form
.SetFocus
.AllowAdditions = True
.AllowEdits = True
'add a new record for inputting
Dim rs As DAO.Recordset
Set rs = .Recordset
rs.AddNew
Set rs = Nothing
.AllowAdditions = false
End With
(used this method because I couldn't get DoCmd.GoToRecord , , acNewRec to
work at all with the subform - said the subform is not open)
The .AllowAdditions = false line throws up an error about the primary key
cannot contain a Null value. So presumable the AllowAdditions command is
trying to save the record at this point (before the user has finished
completing it)?
Therefore, is it possible to create a new record and immediately stop
additional records being added (only through clicking a button on the parent
form each time) to the subform when the user begins to edit the first new
record.
Many thanks.
Pete.
I'm probably going about this the wrong way, but;
I have a parent form with an 'Add Invoice' button to add a new blank invoice
line for the selected PO to the subform. Previously added Invoices for a PO
are locked.
I want to add a blank record on the subform and stop a another new record
appearing when the user begins to edit the first new (blank) record.
I have tried using:-
With subfrmInvoicesReceived.form
.SetFocus
.AllowAdditions = True
.AllowEdits = True
'add a new record for inputting
Dim rs As DAO.Recordset
Set rs = .Recordset
rs.AddNew
Set rs = Nothing
.AllowAdditions = false
End With
(used this method because I couldn't get DoCmd.GoToRecord , , acNewRec to
work at all with the subform - said the subform is not open)
The .AllowAdditions = false line throws up an error about the primary key
cannot contain a Null value. So presumable the AllowAdditions command is
trying to save the record at this point (before the user has finished
completing it)?
Therefore, is it possible to create a new record and immediately stop
additional records being added (only through clicking a button on the parent
form each time) to the subform when the user begins to edit the first new
record.
Many thanks.
Pete.