Results 1 to 7 of 7
  1. #1
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658

    Getting label captions saved during a form crash

    I've been working with several forms over the past few months
    and am not quite sure what causes this, and how to get it to happen deliberately.

    I design a form with English captions in the labels.
    I have a routine that runs at form load that converts the captions to other languages.

    Some of the forms, in design view now show the captions in languages other than English.
    This seemed to happen when I had a form crash, and I answered yes to saving the form's design,
    thinking that it wanted to save the VBA code,
    but I also got the captions for the labels saved in another language that I was testing in.

    Now it would be nice for me to deliberately cause a crash that saves the labels back to English.
    I tried putting a divide by zero in the VBA code for the form and then ending the VBA,
    then go to the form and close it and sure enough it asks if I want to save the design,
    but now that I want it to, it doesn't save the labels in English (as that's what they were at the moment).

    Anyone seen why the form's design changes when it was open (not design view), and how to get it to happen deliberately?

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    If you close a form with VBA and use

    DoCmd.Close acForm "MyForm", AcSaveYes

    It will save any changes without the prompt

    The default action is to prompt I believe.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    @ Minty, #2 The MS helps just say the "object" is saved, but they aren't clear as to which object.
    After testing with various ways of stopping the form after the DoCmd.Close is executed,
    I can confirm the object that the form is based on doesn't save. (Maybe MS means the record "object"?)
    In other words, the label captions remain in Spanish, and are not replaced with English (which is what they are in while the form is open).

  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    The AcSaveYes parameter in the expression above is specifically for the form changes, not the data.

    It's a common mistake for new users to assume that the AcSaveYes option is going to save their data changes, but although Access does that automatically on a form closing, it's nothing to do with that parameter in the DoCmd.Close programming.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658

    Still in Spanish, no change

    @Minty, Post #4

    Here are the screen shots after doing what you suggested (I added a "," and changed it to my form name).

    The design view in Spanish:
    Click image for larger version. 

Name:	230407Lang1.jpg 
Views:	13 
Size:	30.8 KB 
ID:	50065

    The form when it's running, not as an instance:
    Click image for larger version. 

Name:	230407Lang1-1.jpg 
Views:	13 
Size:	61.3 KB 
ID:	50066

    Adding your close line while the form was stopped:
    Click image for larger version. 

Name:	230407Lang2.jpg 
Views:	13 
Size:	15.6 KB 
ID:	50068

    And then going back into form designer, and the label captions didn't change to English (which they were when it ran):
    Click image for larger version. 

Name:	230407Lang3.jpg 
Views:	13 
Size:	75.6 KB 
ID:	50067

    Did I do what you were describing?

    Or is this another case of Access not saving when you tell it to, or like the example I gave in another thread where you tell it NOT to save your VBA code, and it does?

  6. #6
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Have you tried the DoCmd.Save method?

    DoCmd.Save acForm, "Your Form Name"

    https://learn.microsoft.com/en-us/of...ess.docmd.save
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  7. #7
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    @Moke123, post #6

    Just tried that too, still remains in Spanish in the form design.
    In the early days, Access was always crashing and restarting on me.
    It sometimes still happens, but I guess I've subconsciously learned to avoid what caused it.
    However, if I'm in the VBA editor, changing several forms, when I go to the main Access window, and close all the forms, it will still often crash.

    I'm just not sure how to duplicate the error that caused the newer loaded captions to save.
    Often, I didn't notice it till sometime after whatever it was that did it.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 10-05-2014, 07:23 PM
  2. Replies: 1
    Last Post: 04-25-2014, 11:41 AM
  3. Making two label captions the same
    By thebionicredneck2003 in forum Forms
    Replies: 10
    Last Post: 05-10-2013, 01:54 PM
  4. Form with Label captions that size dynamically
    By karmacable in forum Forms
    Replies: 3
    Last Post: 09-26-2011, 10:09 PM
  5. Form Crash
    By AKQTS in forum Forms
    Replies: 3
    Last Post: 10-21-2010, 10:02 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