Problem with entries in a List Box

K

Koulla

Hi,
I have a list box in a form which contains 4 entries.
When I close the form my last action is saved to the
first entry. I try to close the form without saving it
but also the same problem exist.
To not save the information while i close the form i use
the following code:
DoCmd.Close acForm, "BY ConName_ProjName_ProjAdm FORM",
acSaveNo
When i do not close the form the information is right.
When i close it is not. And when i open the form i saw
the changes.

Is there any other way to do that???

The close button has the following code :
Private Sub Command58_Click()
On Error GoTo Err_Command58_Click

DoCmd.Close acForm, "BY ConName_ProjName_ProjAdm FORM",
acSaveNo

Exit_Command58_Click:
Exit Sub

Err_Command58_Click:
MsgBox Err.Description
Resume Exit_Command58_Click

End Sub
 
P

Pat Hartman

The acSaveNo argument for the .Close method is referring to the FORM, NOT
the DATA. Access ALWAYS saves dirty records when you close a form or move
the record pointer to a different record. Do you have code that is dirtying
the form? If you don't want to save the current record when a form is
closed, you'll need to trap the update in the form's BeforeUpdate event.
You can ask if the user wants to save and if he says no, cancel the update:
If MsbBox("Do you want to save?", VBYesNoCancel) = vbYes Then
Else
Cancel = True
End If
 

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