Forcing the save of a record

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
 
D

Dirk Goldgar

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.
 

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