Q. How do I save my form record, in code ?

  • Thread starter Thread starter Jim Jones
  • Start date Start date
J

Jim Jones

Hi,

I have a subform with a button on it that asks "Create a new service
record" ?

If you click yes, it creates a new record, but the record slector on
the left side of the subform has the "pencil" in it, indicating that
the record is still not saved.

I'd like to have the record saved, the instant that the new service
ticket is created, prior to the user doing anything else.

So then, what code would I include in the click event of the cmd
button?

Thanks,
Jim
 
To save the record in the form that currently has focus, you can use:
RunCommand acCmdSaveRecord

A little safer approach is to set the form's Dirty property to False,
because that works even if the focus is somewhere else:
Me.Dirty = False
 
Hi,

I have a subform with a button on it that asks "Create a new service
record" ?

If you click yes, it creates a new record, but the record slector on
the left side of the subform has the "pencil" in it, indicating that
the record is still not saved.

I'd like to have the record saved, the instant that the new service
ticket is created, prior to the user doing anything else.

So then, what code would I include in the click event of the cmd
button?

Thanks,
Jim

DoCmd.RunCommand acCmdSaveRecord
 
DoCmd.RunCommand acCmdSaveRecord

That works well ( I actually decided on Allen's Me.Dirty method).

I have another thing (which WAS happening prior to this).

That is, my pop-up form shows "filtered" on the record selector
navigation buttons:

|< < > >| Filtered

Of course, this causes the pop up form to create a new record every
time I press the next record button, instead of stopping right there.

I have no idea why it's doing that, other than it's a pop up form, and
I have code in there to link it's ServiceTicket field to the subform.

So, if I simply hold down the next record key, it'll create blank
records and save them to the underlying table - which I don't want to
happen.

I want the recordset to stop at it's last record, and don't want to
create new records in this form/table, unless the user specifically
presses the new record button, just like on all the other forms/tables
I have.

Thanks,
Jim
 
That works well ( I actually decided on Allen's Me.Dirty method).

I have another thing (which WAS happening prior to this).

That is, my pop-up form shows "filtered" on the record selector
navigation buttons:

|< < > >| Filtered

Of course, this causes the pop up form to create a new record every
time I press the next record button, instead of stopping right there.

I have no idea why it's doing that, other than it's a pop up form, and
I have code in there to link it's ServiceTicket field to the subform.

So, if I simply hold down the next record key, it'll create blank
records and save them to the underlying table - which I don't want to
happen.

I want the recordset to stop at it's last record, and don't want to
create new records in this form/table, unless the user specifically
presses the new record button, just like on all the other forms/tables
I have.

Thanks,
Jim


I just wanted to add to the description, that when I display the
pop-up form in datasheet view, and click on the last record (which has
'autonumber' in it, the minute I click on that record, a new one is
created.), and I'd like to know how to make the "next record" button
just to advance up to the last record, and NOT create a new record.

Thanks,
Jim
 
Back
Top