automatically save new record

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
 
A

Allen Browne

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.
 
G

Günter Brandstätter

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top