[AccessD] IMPORT THE FORM

jwcolby jwcolby at colbyconsulting.com
Wed Feb 11 13:44:49 CST 2009


This email will document how to import a form into your database that I provide to you.  WARNING! 
If you have modified frmDemoCtls to be the way you want it, rename the form before performing the 
following.

•	Cut and paste the form definition from the email with that stuff into a text file that you can 
deal with.  As an example I used the path 
"c:\Users\jwcolby\Documents\ClassesAndEventsDemo\frmDemoCtlsImport.txt".
•	In your database click Insert / Module and immediately save it as basImportForm.
•	Insert the following code into the module:

Function ExportForm(strFrmName As String, strExportPath As String)
     Application.SaveAsText acForm, strFrmName, strExportPath
End Function

Function ImportForm(strFrmName As String, strImportPath As String)
     Application.LoadFromText acForm, strFrmName, strImportPath
End Function

These functions are just wrappers to VBA code that allows importing and exporting forms to / froim 
text files.

•	Compile and save basImportform.
•	In the debug window cut and paste or type in the following (modifying the path to your own) and 
then hit enter:

ImportForm "frmDemoCtls", "c:\Users\jwcolby\Documents\ClassesAndEventsDemo\frmDemoCtlsImport.txt"

•	Click on the form tab of the database and open frmDemoCtls.
•	Notice that the form probably looks different than your old form.
•	Tab through the form and notice that the text and combo controls change color as they gain / lose 
the focus.

I will use this method of feeding you forms in the future.  If you have any questions or something 
does not work as planned, let me know.

-- 
John W. Colby
www.ColbyConsulting.com



More information about the AccessD mailing list