Issue With Buttons in Access

15 pts.
Tags:
Access
Access 2007
button
error message
event procedure
onopen
I'm building an Access DB and would like to have people interact with it through forms and command buttons.  Adding command buttons should be very straight forward with the wizard, and it is until I test the button - the buttons I create don't work and give me this error message: A problem occurred while MS Office Access was communicating with the OLE server or ActiveX Control *The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure] *There may have been an error evaluating the function, event, or macro. This error occurs when an event has failed to run because Microsoft Office Access cannot evaluate the location of the logic for the event. For example, if the OnOpen property of a form is set to =[Field], this error occurs because Access expects a macro or event name to run when the event is fired. What can I do to make the buttons work?  I'm not trying to do anything complicated, just open and close related forms. Thank you for the help.

Software/Hardware used:
MS Access 2007

Answer Wiki

Thanks. We'll let you know when a new response is added.

-Select the button (design view)
-Go to the property sheet
-Select the ‘Event’ tab
-Clear the actions for all of the events

Then start over defining the action for the desired event (most likely OnClick).

If you want to close the current form when pressing the button, then:

1) Select the button (design view)
2) Go to the property sheet
3) Select the ‘Event’ tab
4) On the ‘On Click’ button row click on the ‘…’ button and select ‘Macro Builder’
5) When creating the macro choose ‘Close’ from the Action dropdown box
6) Close the macro builder (and save the changes)
7) Test your button.

If you want to close another form, then in step 5 from the above list, choose ‘Form’ as the object type in the ‘Action Arguments’ section (at the bottom of the window), and select the appropriate form name from the ‘Object Name’ dropdown list.

Let us know how it goes.

-CarlosDL

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • JTB
    Thanks very much for the answer! The solution worked great for solving my need to open/close forms, and I'm sure I can use the macros for other actions as well, but I'm planning on eventually including relatively complicated search functions that I found code for. Is there no way to make the buttons actually run the event procedures and the VBA code? Thank you for the help.
    15 pointsBadges:
    report
  • carlosdl
    Glad it worked. You could create a VBA function/procedure and execute a macro from it, and you could also create a macro that executes a VBA function/procedure as one of its actions.
    68,405 pointsBadges:
    report
  • JTB
    [...] Issue With Buttons in Access, which was asked by JTB and answered by [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following