automatically save new record

  • Thread starter Thread starter george
  • Start date Start date
G

george

Hi to all,

I have a form, frmClients, with a command button on it,
cmdOpenClientDetails.

When I insert a new client and open my frmClientDetails
(before a save the new client record) inserting all
relevant details and trying to save the record I get a
message that there is no related record in my frmClients.

This obviously happens since I have not yet saved the new
client record. So I have to manually save every new client
record before I open the other form.

Is there a way to track new records only and then
automatically save them each time I leave the form
(without closing it) in order to open the other form?

thanks in advance, george
 
In the Click event of your command button, before you open the other form,
put:
If Me.Dirty Then
Me.Dirty = False
End If

That saves the record.
 
Hi George,

in your cmdOpenClientDetails_OnClick event, just add the line Me.Refresh
before you open the ClientDetails-Form. This causes a "save" of all changes
that you made to the forms recordset.

hth
Günter
 
Back
Top