Results 1 to 12 of 12
  1. #1
    Join Date
    May 2013
    Posts
    6

    Unanswered: Button to copy from textbox to textbox wont work after reopening access.

    Hello All!

    I have read some of the posts on how to create a button to copy an input from one textbox to another textbox, which were very helpful. It works fine at first, however, after re-opening access the code for that button no longer does what it originally has done before.

    Scenario:
    I am creating a customer form where fields for an address is present as well as a shipping address. When the shipping address is the same, a button will copy the original address to the shipping address.

    Quickly, I have created txtF_Name and respectively txtS_F_Name where txtS_F_Name will duplicate data from txtF_Name if btnCopy is clicked.

    Code for the button with the On Click Event simply is:
    Me.txtS_F_Name = Me.txtF_Name

    All works well on the first go around. However, after closing down the database and reopening it and the form, the copy button will no longer function. I am sure there is some kind of rookie mistake of mine, and afterall I am a rookie, but any ideas or solutions would be appreciated. Thanks for the help in advance!

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    So, you created the Command Button, with the single line of code, as given, it worked one time, and now will no longer work?

    Does anything happen when you click on the Command Button? Error messages/numbers?

    Are you trying to do this in a just created New Record or in an existing Record?

    One possibility: Although we usually think of Forms, and even entire Databases, when we speak of corruption, Controls, such as Command Buttons and Comboboxes, can and do become corrupted, and seem particularly susceptible to this during app development. The test/cure for this is short and simple...delete and then re-create the Control.

    Linq ;0)>
    Last edited by Missinglinq; 05-08-13 at 09:55.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    May 2013
    Posts
    6
    Yeah that would be the only code written to that button. I do not receive any errors, just no response from the button.

    I've actually created a new database to test this configuration, but it still does the same thing. Is there something I need to do save the vba coding? or reinforce its properties?

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Did you checked that the control is actually linked to it's event handler for the Click event (see attached screenshot)?
    Attached Thumbnails Attached Thumbnails ScreenShot_Event_Linked_Control.jpg  
    Have a nice day!

  5. #5
    Join Date
    May 2013
    Posts
    6
    Sindho, I have verified that the control is under the correct property.

  6. #6
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    I suspect that you're going to have to ZIP the file up and attach it to a post for us to try the 'laying on of hands' to see if we can figure out what's going on! You don't say what version you're running, but if you could save it in 2007 format (2003 format would be even better!) more of us could open it up for examination.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    Join Date
    May 2013
    Posts
    6
    I have attached my database which was converted to a 2002-2003 file. I myself am working on 2007.

    The form I am working with is frmNewRMA which has defaulted to load.

    I appreciate the help and please let me know if any more information is necessary.
    Attached Files Attached Files

  8. #8
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Don't know what to tell you, Andy! Downloaded your app, ran the Form, filled it in, and it works exactly as you intend for it to work! Tried various combinations:

    Entering original address and copying it over to the shipping address, closing then re-opening the Database, and doing the same thing to another Record. No problem.

    Entering original address and copying it over to the shipping address, then changing an item in the original address and copying it over to the shipping address, again, then closing and re-opening the Database, and doing the same thing to another Record. No problem.

    Entering original address and copying it over to the shipping address. Moving to a New Record and repeating this, then closing and re-opening the Database, and doing the same thing to another Record. No problem.

    Can only think of two possibilities; I'd check them out, in this order:

    First, you say that you're running 2007, does any VBA code run? Code does not run in 2007/2010 unless your database resides in a folder that has been declared a “trusted” location.

    To trust your folder, click:
    1. Office Button (top left)
    2. Access Options (bottom of dialog)
    3. Trust Center (left)
    4. Trust Center Settings (button)
    5. Trusted Locations (left)
    6. Add new location (button)


    Secondly, while I see nothing in this code that really should be reliant on a Reference Library, when apps run fine on one machine and not on another, one the first things you have to think about are Missing References, and missing references can cause problems, even in code that doesn't directly refer to the missing reference. So I suppose you need to check for this.

    If you haven't checked for this kind of thing before, here are Doug Steele's detailed instructions on how to troubleshoot the problem:

    Access Reference Problems

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  9. #9
    Join Date
    May 2013
    Posts
    6
    Yikes... I think a lot of answers of mine have just been answered and I feel a little silly about the solution! I guess I would have never known to do this as I did not start learning vba with Access and was completely unaware.

    That did the job, Linq! Thanks for the time and help.

  10. #10
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    So the answer was declaring the Folder as 'Trusted?'

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  11. #11
    Join Date
    May 2013
    Posts
    6
    Yes, declaring the folder as trusted worked.

  12. #12
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    One thing that I really like about Access is that no matter how long you work with it (I'm at 12+ years, now) there's always something new to learn! If you'd simply posted that you had the above code behind a Command Button, and that it didn't work, I suspect that both Sinndho and myself would have asked you if the Folder was 'Trusted.' But your saying that it worked, immediately after adding it, in Design View, kept me from even considering that as a possible cause! I didn't realize that code in an non-trusted app would run until the app was closed and re-opened!

    Glad we could help you!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •