473,659 Members | 2,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

importing form source code into access

I need to process the source code associated with the forms
outside access, and import the changes back to Access.

I find that I can export the source code of a form, but when I
subsequently import it, even with no change, I get a message saying
the module name is illegal. If the form is named Form_NewPartici pant,
the export file gets named Form_NewPartici pant.cls, and when I reimport
it, the error message quotes the name "Form_NewPartic ipants1.cls",
(notice the digit '1') and says module names may not start "Form_".

The form is not associated with a module (as far as I can understand).
In the project browser, the forms appear in the folder "Microsoft
Access Class Objects", not under the folders Modules or Class Modules.

The top of the export file reads:

VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Form_NewPartic ipant"
Attribute VB_GlobalNameSp ace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredI d = True
Attribute VB_Exposed = False

and then follows the code I usually see in the code editor.

I first tried changing the file name, got same message. Then changed
the "Attribute VB_Name" removing the Form_ part, and I got a new class
module, instead of updating the form's code.

I have 43 forms, and having to copy and paste each separately is a
nissance, because I will have to do this frequently.

Any suggestion?

Thanks.

Nov 13 '05 #1
2 4159
Enrio,
I need to process the source code associated with the forms
outside access, and import the changes back to Access.


Why do you need to do this ?
You have a Frontend - Backend database don't you?
Why can't you just update the FE?
Or am I missing something here?

But if you *need* to do what you want:
Maybe the undocumented SaveAsText - LoadFromText procedures are what you are looking for?
Check out Google for lots of information about this.
You could export all your forms and write some code to update the changed ones.

--
Hope this helps
Arno R

Nov 13 '05 #2
The problem is that you can't associate code with a form object during import,
so it tries to import the code as a stand-alone module instead. You can get
around this by exporting the entire form object, including the code instead of
just the code. To do this, you use the undocumented "SaveAsText " procedure.
To load the object back in, use "LoadFromTe xt".

Example:
SaveAsText acForm, "frmReportTimeW orkedByDate",
"C:\frmReportTi meWorkedByDate. frm"

In the file that is exported, you can identify the code by looking for the
first line that starts with "CodeBehindForm ". There are some "Attribute ..."
lines after that, and then the VBA code itself begins. The code section is
the last thing in the file, and there is no additional non-VBA content after
it.

On 31 Mar 2005 06:57:58 -0800, en***@online.no wrote:
I need to process the source code associated with the forms
outside access, and import the changes back to Access.

I find that I can export the source code of a form, but when I
subsequently import it, even with no change, I get a message saying
the module name is illegal. If the form is named Form_NewPartici pant,
the export file gets named Form_NewPartici pant.cls, and when I reimport
it, the error message quotes the name "Form_NewPartic ipants1.cls",
(notice the digit '1') and says module names may not start "Form_".

The form is not associated with a module (as far as I can understand).
In the project browser, the forms appear in the folder "Microsoft
Access Class Objects", not under the folders Modules or Class Modules.

The top of the export file reads:

VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Form_NewPartic ipant"
Attribute VB_GlobalNameSp ace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredI d = True
Attribute VB_Exposed = False

and then follows the code I usually see in the code editor.

I first tried changing the file name, got same message. Then changed
the "Attribute VB_Name" removing the Form_ part, and I got a new class
module, instead of updating the form's code.

I have 43 forms, and having to copy and paste each separately is a
nissance, because I will have to do this frequently.

Any suggestion?

Thanks.


Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1999
by: TheElectron707 | last post by:
Hi! I have a scenario in which i am importing a VERY LARGE database over the network. (Linking is not my solution). Now it takes many hours to import the complete database. I want that once the whole database has been imported, next time when i import only the NEWER records come in (almost database refresh every 24hours) so that the time taken is much much smaller and the network donot get chocked for many hours daily. Any solution...
9
4030
by: Edward S | last post by:
I budget for a Project in an Excel sheet as illustrated below. The months below are usually a 2 year period i.e. 24 months, though it could be over 24 months depending upon a Project. I then need to input this in an Access database, where I do a comparison with the Actual cost. The table “TblBudget” in Access is made of 4 fields, namely: (1) CostElement (2) CostCenter (3) Month (4) Amount$. At the moment this method is very cumbersome....
1
3670
by: sparks | last post by:
I have never done this and wanted to ask people who have what is the best way. One person said import it to excel, then import it into access table. but since this will be done a lot, I am trying to avoid this extra step. can access read in this file directly into a table as append data? thank you very much for any pointers
7
3054
by: Darren | last post by:
I have been attempting to create a reservation planning form in excel that imports Data from an Access database and inserts that information automaticly into the correct spreed sheet and the correct cells within that worksheet. The Excel Book is made up of 12 worksheets named Jan-Dec. Each worksheet has columns labeled as each day of that month. Column 'A' is reserved for 19 rows named "room1 - room19". The data I am importing from the...
5
3174
by: dixie | last post by:
If I sent a user an empty database container - dB with no tables and I needed them to import their tables into it and one of their tables was a hidden table with the prefix Usys, is there any way in code I can get that table imported without them having to go to options and show hidden tables and then import it manually? dixie
3
8919
by: Conrad F | last post by:
Hello All, I know how to import a specific named excel sheet into a datagrid using ADO.NET by setting up a JET connection and then SELECTing data from the sheet. However, for a real world application, I would typically not know what the names of the sheets are going to be before I open the Excel file. I am wondering if there is a SELECT statement that would get me the list of sheet names so that I can place them in a combobox and
3
3344
by: mukeshsrivastav | last post by:
dear sir i want to move form excel to access. i have 5 excel file having same formats and fields.now i want to import all data in one access table. importing one file is easy .but importing and appending second file in last of the access table created earlier by importing data. thanks .plz help me.
4
6492
by: johnporter123 | last post by:
Does anyone have a method of importing a large "FLAT" CSV file into access. The file has well over 255 columns (Fields). Before anyone flames me over normalization, I do not have access to the source DB for the file and the CSV file has the data I need, but it is buried in this huge text file output from another Compan'y database. The purpose of getting it into Access is so that I can adjust it to 1st normal form, and recompute the tables in...
3
5166
by: HistoricVFP | last post by:
Hello, I’ve been given the task of importing .dbf files from a very old version of Visual FoxPro (version 2.1) into Access (2003). When I import the data straight to Access it errors with: External table is not in the expected format. (Error 3274) I’ve tried the following but it did not work: “To import data from a FoxPro database, use the Microsoft Visual FoxPro ODBC driver. To do so, follow these steps: 1. Click Start, and then...
0
8427
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8332
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2750
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.