New record not updating when the form is closed

G

Giem

This may be already answered somewhere but the search function on this
webpage isn't working properly today.

I have a form that is used to add new records to a few different tables.
Everything works fine, except when you go to add a new record and enter the
first piece of information, then close the form immediately. When you do this
the record isn't updated, and so required fields in the tables do not whine
about being empty. I have a button that uses DoCmd.Close on the form to close
it. The form that opens this form uses this to open it:

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.Close

stDocName = "New Repair"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.GoToRecord , , acNewRec



I want to make sure that the user is forced to either cancel the new record,
or fill in all of the records on the form. I am assuming I want to somehow
update the record as it stands before closing so it triggers a problem with
the required fields, just not sure the best way to do that.
 
L

Linq Adams via AccessMonster.com

This is a known bug in Access. Before using DoCmd.Close you have to force the
record to be saved, else if required fields are empty the record will simply
be dumped without any warning.

If Me. Dirty Then Me.Dirty = False
DoCmd.Close

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
L

Linq Adams via AccessMonster.com

Glad to help!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 

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