Error Closing Form Runtime 2585

halem2

Registered User.
Local time
Today, 09:56
Joined
Nov 8, 2006
Messages
180
Hi folks:

using MS Access 2000. I have this sub that works great but the DoCmd.CLose (line 5) errors out. It reads "Runtime Error 2585. This action can't be processed g on a form or report". Any ideas?

Private Sub Form_Current()

If Me.NewRecord = True Then
Me.Caption = "To add new go to Forefront ..."
MsgBox "To Add New Vendors Go To FOREFRONT", vbOKOnly
DoCmd.Close acForm, "frmVendor", acSaveNo

Else

Me.Caption = IIf(IsNull(Me!Vendor_Name), " ", "Data for " & Me!Vendor_Name)

End If


End Sub

thanks :confused:
 
rather than use the Current() event why not use the BeforeUpdate() event? that way you can cancel the adding of the new record and close the form
 
I need it on the onCurrent on the form itself so it would update the caption as the user changes record. I got a workaround: I'm using

DoCmd.GoToRecord , , acFirst

which takes them back to the frst record on the form.

thanks for the help.
 

Users who are viewing this thread

Back
Top Bottom