PC Review


Reply
Thread Tools Rate Thread

Can't load or unload this object

 
 
Stuart Grant
Guest
Posts: n/a
 
      30th Aug 2006
I have a small form Exchange Rates on which I enter the current exchange
rates for two or more currencies.

It has two buttons Next and Finish

When I click Next it moves to the next record but when I click Finish I get
the error message "Can't load or unload this object". The code for the On
Click Event is
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Unload Form(Exchange Rates)

Why?

Stuart


 
Reply With Quote
 
 
 
 
Brendan Reynolds
Guest
Posts: n/a
 
      30th Aug 2006
Is that your actual code? The reason I ask is that I can not see any way in
which that code would compile, let alone run, in VBA code behind an Access
form.

There's no function named 'Form' in Access or VBA, and to pass the name of a
form or other object to a function it would need to be enclosed in quotes.

To close an Access form, use the DoCmd.Close method. I suspect your code may
be adapted from an example intended for other VBA-enabled applications such
as Word or Excel. Access forms are very different from the UserForms used by
those applications.

--
Brendan Reynolds
Access MVP


"Stuart Grant" <sagranatbluewin.ch> wrote in message
news:%(E-Mail Removed)...
>I have a small form Exchange Rates on which I enter the current exchange
>rates for two or more currencies.
>
> It has two buttons Next and Finish
>
> When I click Next it moves to the next record but when I click Finish I
> get the error message "Can't load or unload this object". The code for
> the On Click Event is
> DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
> Unload Form(Exchange Rates)
>
> Why?
>
> Stuart
>
>



 
Reply With Quote
 
Stuart Grant
Guest
Posts: n/a
 
      31st Aug 2006
Brendan: Thanks for your help

I don't know where the code came from. It didn't make sense to me. It must
have come from the Button Wizard which I used to create the button since it
has all the trade mark boiler-plate On Error and Exit code.

Anyway I replaced it with DoCmd.Close and it works fine. Thanks again.

Stuart

"Brendan Reynolds" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is that your actual code? The reason I ask is that I can not see any way
> in which that code would compile, let alone run, in VBA code behind an
> Access form.
>
> There's no function named 'Form' in Access or VBA, and to pass the name of
> a form or other object to a function it would need to be enclosed in
> quotes.
>
> To close an Access form, use the DoCmd.Close method. I suspect your code
> may be adapted from an example intended for other VBA-enabled applications
> such as Word or Excel. Access forms are very different from the UserForms
> used by those applications.
>
> --
> Brendan Reynolds
> Access MVP



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Load and unload DLL's. Possible? Ivan Microsoft C# .NET 1 13th Nov 2008 05:30 PM
Can't load or unload object jase Microsoft Excel Programming 1 9th Jun 2005 08:52 PM
Evènements Load et Unload imej-clavier Microsoft Excel Misc 0 21st Oct 2004 07:22 PM
Load and Unload Problem =?Utf-8?B?Q2hha2thcmFkZWVw?= Microsoft Outlook VBA Programming 3 24th Feb 2004 05:12 PM
Load/unload count Jani Ahti Storage Devices 5 19th Nov 2003 06:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:45 AM.