Forcing the save of a record

  • Thread starter Thread starter Brad McCulloch
  • Start date Start date
B

Brad McCulloch

Hi All.

I have a form which contains a subform. I want to create
a new record in my subform based on information contained
in the suburb textbox. I've created an insert into query
which works fine except, for new records, the user needs
to explicity save the record prior to clicking the
button. If they don't the new master record does not
exists and the referential integrity rule is broken.

I could fix this by removing the relationship between the
master an sub tables, but i'd much rather save the new
record in the script.

Any ideas on how you can duplicate the effect of Record-
save record in VBA?

Regards,

Brad
 
Brad McCulloch said:
Hi All.

I have a form which contains a subform. I want to create
a new record in my subform based on information contained
in the suburb textbox. I've created an insert into query
which works fine except, for new records, the user needs
to explicity save the record prior to clicking the
button. If they don't the new master record does not
exists and the referential integrity rule is broken.

I could fix this by removing the relationship between the
master an sub tables, but i'd much rather save the new
record in the script.

Any ideas on how you can duplicate the effect of Record-

There are several ways. Here are two:

RunCommand acCmdSaveRecord

or

Me.Dirty = False

I like the latter, but you have to be aware that if for some reason the
record can't be saved, the message you get says something about being
unable to set the property, which can be confusing if it ever makes its
way out to where the user can see it.
 
Back
Top