473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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_NewParticipant,
the export file gets named Form_NewParticipant.cls, and when I reimport
it, the error message quotes the name "Form_NewParticipants1.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_NewParticipant"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = 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 4142
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 "LoadFromText".

Example:
SaveAsText acForm, "frmReportTimeWorkedByDate",
"C:\frmReportTimeWorkedByDate.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_NewParticipant,
the export file gets named Form_NewParticipant.cls, and when I reimport
it, the error message quotes the name "Form_NewParticipants1.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_NewParticipant"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = 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
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...
9
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...
1
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...
7
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...
5
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...
3
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...
3
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...
4
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...
3
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: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.