Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 46
  1. #16
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521

    You found it okay?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #17
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,784
    There is a way actually. With a form/report in design view and the properties window open, there's a dropdown at the top of the properties window. You can select the desired control there and Access will select it in design view.
    FWIW, it's about the only way to select controls or labels that have been (because they have to be) placed behind some other control. Say you need to place a rectangle behind another control to perform some sort of conditional highlighting. You cannot select the control in the lower layer because it's behind the only one you can click on.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #18
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Yes, I found it. Thanks.

    Respectfully,

    Lou Reed

  4. #19
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Code:
    As long as the names of the buttons on both forms are the same, it is a quick fix.  Just go in to the events properties for the button control on the new form, click the ... button, and select  "Code Builder".  Access will link the existing code to that button.
    I have a new form that I created with a button and some legacy code from a previous db. I would like to try this it seems very direct so it should be easy to work. However, when I have the events properties for the button control on the new form, if I click the button and select code builder then I will get just the first and last line of the Sub. It will not link existing code. This is the point of confusion.

    I have some legacy code and I have a button on the form (new button and new form). I just do not know how to link them together. Please elaborate on the statement above.

    Respectfully,

    Lou Reed

  5. #20
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    I need an answer to this if possible

    The previous post by me is important to my work today. I need answer to this post if it is at all possible.

    I have some code from one db that works and a form with certain buttons on a new db the control have no VBA code behind them. I would like to connect up
    the old code with the new buttons.

    The method described here does not say how to get a to point where I can simply connect up the button. Right there is no code behind the form with only buttons on it.

    Somehow I must copy and paste the working code there. That is the easy part. The hard part is getting a form to show me the area where I can start pasting the old code.

    The only way I know is to select control and then select ellipsis and then it gives you the first and last lines of the db. I do not need these first and last lines. I need only to paste the code and connect it to a control (usually a button in my case). But first I must get the blank page open for pasting code. How do I do that?

    Respectfully,

    Lou Reed

  6. #21
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    I have some legacy code and I have a button on the form (new button and new form). I just do not know how to link them together.
    You can't "link" them. You have to copy-paste the old code into the sub for the button on the new form. As long as the button names are the same, you can just overwrite (i.e. delete) the two lines that Access automatically starts with.

    One major caveat with this method is that you have to be sure that the code you paste in does not refer to controls or other objects that you haven't created yet. Compiling the code will often catch these for you, but not always.

  7. #22
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, I will get it a try. Thanks for your input.

    Respectfully,

    Lou Reed

  8. #23
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, on this form I have two Subs one says Form_GotFocus() and the other says Form_Load().


    I know of no way to connect this code up to the controls on the form. It is not like Form_btnRefresh() where it is obvious what control is associated with what code Sub.

    Any help appreciated. Thanks in advance.

    Respectfully,


    Lou Reed

  9. #24
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,784
    that code is not for controls - it actually tells you that it's for a form. Go to where the original code is on the same form and copy/paste as suggested. I for one would not delete all the lines; I'd leave the first and last intact and paste what comes in between. My fear is that if you create the start of the procedure from the property sheet via the ellipses (...) then delete it and paste all of the procedure, that the event becomes orphaned from the control or object. Probably would not happen unless you saved or compiled the project before pasting the entire event code, but it happened to me once. It's one of those things that once it happens, you tend to avoid putting yourself in that situation again. Probably 99 times out of 100, it won't be a problem.

    BTW - while you are in any module that belongs to a form or report, that object is highlighted in the project window (where all the form/report/module objects are listed). That's one way of knowing where you are.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #25
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    You mean to just copy and paste from the form with all the existing VBA code for frmAttendance to the new frmAttendance in the new db. There is no need to connect these? Just copy and paste?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed

  11. #26
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    There is no need to connect these?
    More than no need - you can't connect them. Event subs for a form have to be in the code module for that form. Access will not look elsewhere.

    But I have a question - is there a reason why you do not just import the whole form from the old database into the new one, rather than recreating it from scratch? It would save you a whole lot of trouble.

  12. #27
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    This form has gone through many iteration besides the VBA code. Importing it was the first thing I tried. It was really a bad idea. They were just too different.
    However, now I am taking it piece by piece. Importing the form was a nightmare.

    Respectfully,

    Lou Reed

  13. #28
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Quote Originally Posted by pbaldy View Post
    There is a way actually. With a form/report in design view and the properties window open, there's a dropdown at the top of the properties window. You can select the desired control there and Access will select it in design view.

    Please elaborate on this. I am anxious to try t. Is there a reference for it?

    Respectfully,

    Lou Reed

  14. #29
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I don't know of a reference, but I thought you found it? You said you did in post 18. It's here:
    Attached Thumbnails Attached Thumbnails PropDropDown.jpg  
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #30
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, I will try it. it is just that MS Access can get complicated and then it becomes quite opaque.

    Very opaque.

    I thanks you for your help.

    Respectfully,

    Lou Reed

Page 2 of 4 FirstFirst 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Restoring another form
    By LonghronJ in forum Modules
    Replies: 1
    Last Post: 07-17-2015, 10:43 AM
  2. Replies: 3
    Last Post: 10-16-2014, 08:49 AM
  3. Saving/Restoring Modified Datasheet Form
    By EddieN1 in forum Programming
    Replies: 1
    Last Post: 01-20-2012, 09:48 PM
  4. Restoring a lost field with a Unique Identifier
    By DBinazeski in forum Access
    Replies: 5
    Last Post: 12-20-2010, 08:02 AM
  5. Pound signs restoring tables
    By Djacsnp in forum Access
    Replies: 2
    Last Post: 04-20-2010, 05:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums