Save new FORM object with rename (Acc 2.0)


Question

I create a new form object in my Access 2.0 application (dynamically from code, with the createform() function). Now I do not want the user to see the "Save As" dialog once this new form is closed. Instead, I would rather just close the form without prompting to save it or - even better - Save it with a name predefined in code. Does anybody have an idea how to do this?

Answer

From: Shamil Salakhetdinov <shamil@marta.darts.spb.ru>
Subject: Re: Save new FORM object
Date: 15 January 1999 2:56

Hope this "magic" code works OK for you - please send me a note if somebody supplies you with less tricky
solution...

Function test ()
    Dim frm As Form
    Set frm = CreateForm()

    Dim strTempFrmName As String
    Dim strNewFrmName As String

    strNewFrmName = "fmrTest"
    strTempFrmName = frm.name

    '*+ magic save sequence
    DoCmd SetWarnings False
    DoCmd Echo False
    SendKeys "{Enter}"
    DoCmd Close A_FORM, frm.name
    DoCmd Rename strNewFrmName, A_FORM, strTempFrmName
    DoCmd Echo True
    DoCmd SetWarnings True
    '*- magic save sequence
End Function

HTH,
Shamil


HOME    TOPICS

Copyright © 1999 by Shamil Salakhetdinov.
All rights reserved. Terms of use.

Last updated: October 10, 2006