Re: Error: 'saveRecord' isn't available now

From: Tim Ferguson (FergusonTG_at_softhome.net)
Date: 02/16/05


Date: Wed, 16 Feb 2005 10:19:06 -0800


=?Utf-8?B?cG9rZGJ6?= <pokdbz@discussions.microsoft.com> wrote in
news:F5DB73D6-0F31-4DC4-876E-6C5F6FD1E8E7@microsoft.com:

> I put in the dirty statement below and it is giving me this error:
>
> Object Variable or With Block not set

> If Me.Dirty = True Then
> Me.Dirty = False
> End If
>

Where is this code? What is causing it to run. I assumed from your use of

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord

that it is in a form module. If it's not, then you need to reference the
form that you do want to save:

  With Forms("HopeThisFormIsOpenOnTheDesktop")
    If .Dirty Then .Dirty = False
  End With

If it's not running behind a form, how do you know which record is going
to be saved by running the code above? Seems a bit of a crossed-your-
fingers job to me!

All the best

Tim F



Relevant Pages