automoatic update on form close

D

dfeigen115

I have a form that is used to edit a specifc row of data. the row is selected
based on input criteria passed from another form. The user optionally
updates multipl fields on the form. The form fields are independantly
evaluated for "not null" values and if not null, a sql "update" statement is
used to apply the changes to the row. A copy of the update code follows:

If Not IsNull(Me.MPMImpPlanDt) Then
mpmimp = FormatDateTime(Me.MPMImpPlanDt, vbShortDate)
strSQL0 = "UPDATE cacrdescription SET cacrstatus = 'implementing',
mpmimpplanwho = '" & Me.MPMImpPlanWho & "', mpmimpplandt = '" & mpmimp & "'
where (Cacrdescription.CACRNumber = " & Me.CACR_number & ");"
MsgBox (strSQL0)
DoCmd.RunSQL strSQL0
End If

After all of the optional fields are evaluated and updated, the form is
closed using the statement:
DoCmd.Close acForm, "cacrroutingentry"

The close form is causing an extra incomplete record to be added to the table.

I need to suppress the extra record from being added, when the form is being
closed.

Thanks in advance,
Dan
 

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