Re: Runtime Error

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




One more thing I need to post to complete this subject. John your solution
worked.

However, once I made the change it seemed to make no difference. This has
happened to me before with other versions of Access but always using the 2000
format. I have spent many more hours trying variations of suggested code to
no avail. However, in my struggles and in the past by mistake, I have closed
the db which compacts it (based on my set-up). When I reopen the db the
original suggested code worked? So my recommendation to all new users is if
the suggested code does not work, try to compact the db, close it and then
reopen it and oddly, it works!
--
Thanks,

Dennis


"John W. Vinson" wrote:

On Fri, 26 Jun 2009 13:11:01 -0700, Don <Don@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I am trying to run this code in the On Close or the On Unload event of my form:

Private Sub Form_Unload(Cancel As Integer)
If IsNull(Me.PrintDate) And IsNull(Me.Date) Then

Else
If IsNull(Me.PrintDate) Then
Me.[PrintDate] = Now
Me.DidNotPrint = "Yes"



End If
End If

End Sub

Use the form's BeforeUpdate event instead. Both close and unload come too late
- the record has already been saved to disk at that point.
--

John W. Vinson [MVP]

.



Relevant Pages

  • Re: Formatting Date
    ... "John W. Vinson" wrote: ... Private Sub Option158_Click ... It either prints all the work orders or nothing. ...
    (microsoft.public.access.forms)
  • Re: Question??
    ... "John W. Vinson" wrote: ... I'd use the DoubleClick event rather than click (click is ... Private Sub LastName_DblClick ...
    (microsoft.public.access.modulesdaovba)
  • Re: Event Procedure Natural Key
    ... I ran some tests without the validation rules and it works well. ... "John W. Vinson" wrote: ... Private Sub Form_BeforeInsert ...
    (microsoft.public.access.modulesdaovba)
  • Re: Dialog box prevents record deleting
    ... "John W. Vinson" wrote: ... Private Sub cmdDelete_Click ... Dim iAns As Integer ...
    (microsoft.public.access.tablesdbdesign)
  • Re: criteria
    ... Private Sub Report_Close ... "John W. Vinson" wrote: ... What happens if you open the report ...
    (microsoft.public.access.tablesdbdesign)