Error on assigning value when going into Form Design

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I have an access 97 application. I want to enter some modified info
when a user leaves a certain screen. The code below works when the user is
using the interface but whenever I go into Form Design it gives me a error
about 'You can't assign null to this value' and I have to close out and
reopen the application. How can I trap to not run these lines of code when
going into Form Design?

Thanks

Don

Private Sub Form_Unload(Cancel As Integer)
Me.ModifiedBY = gblSysUser
Me.ModifiedDate = VBA.Now
End Sub
 
Form_Unload is too late to assign these values to the record in the form.

Use Form_BeforeUpdate instead.
 
Back
Top