Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2008

Tip: Looking for answers? Try searching our database.

Form control events get broken.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DavidBoyle - 07 Mar 2008 15:30 GMT
My colleagues and I have a problem that occurs while designing access forms
and it isn't helped by the fact that our applications have a lot of buttons
on their forms.

The best way I can describe the problem is to explain how to repeat the
problematic behavior.

1) Create a blank form and stick a button on it and connect it to some code
say:

Private Sub Command6_Click()
MsgBox ("Hello World")
End Sub

2) Change the form to design view.

Right Click the button then do edit cut, edit paste from the main menu.

Right click the form title bar and choose form view.

Click the button in no longer works.

Go back to design view, right click the button and build event, you'll find
the cursor flashing away happily in the click event. Close the visual basic
editor put the form back in form view and the button works happily again.

Obviously I'd like to be able to cut and paste buttons without breaking their
events, but can anyone explain why the link to the code gets broken? It this
behaviour by design?
Allen Browne - 07 Mar 2008 15:43 GMT
The behavior is the way Access has always worked. If you cut/copy a button,
the code does not go with it. When you paste a control into a form that has
the right code for an event procedure, the relevant property does not get
set to [Event Procedure].

It does work the other way round, though. After pasting controls in, you can
go to the code window, select all the code (Ctrl+A), cut (Ctrl+X), and paste
(Ctrl+V.) You will find that Access does set the relevent properties to
[Event Procedure] for the controls on the form.

If you have not yet discovered MZ Tools (mztools.com), it does provide a way
to cut/paste controls and their code.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> My colleagues and I have a problem that occurs while designing access
> forms
[quoted text clipped - 32 lines]
> this
> behaviour by design?
DavidBoyle - 10 Mar 2008 11:11 GMT
Thanks so much - David

>The behavior is the way Access has always worked. If you cut/copy a button,
>the code does not go with it. When you paste a control into a form that has
[quoted text clipped - 14 lines]
>> this
>> behaviour by design?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.