473,387 Members | 1,890 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,387 software developers and data experts.

Code Issues

Hi

Sometimes when i edit previously saved VBA code e.g. To update field
names etc the revised code does not work.
Even if i copy and paste in a previous version it does not work.

The only solution seems to be to delete the existing code, re-type ir
word for word and hey presto it works.

Of course you might think typo or something but its like Access seems
to totally ignore the code.

This may sound daft but its like Access seems to have a memory of
previously typed code and it seems to be remember the earlier code and
does not 'want' to process the new stuff.....

Am i imagining this or is there something I need to do?

I created stacks of functions a few months ago. Some of the field
names have changed and I updated both the query and the function for
the new code. Access rejected it. My only solution was to delete that
module and re-key the code again.

Any suggestions

chris

Nov 13 '05 #1
13 2018
There has, in the past, been a problem with form code ceasing to work -- it
was there, but it just didn't execute. But that error happened even if the
most recent changes had not been to the code that stopped working. There was
much speculation as to why, but no definitive answer.

No one has reported it as being either consistent or frequent, and I haven't
heard of it happening with Access 2002 or 2003. You did not say what version
of Access you are using, so I wouldn't speculate if this is what you have
experienced.

Some have had luck using "save as text" to save the form's module and then
"load from text" in similar situations.
Sorry I can't be of any real help.

Larry Linson
Micosoft Access MVP
"AFKAFB" <ch***********@rbos.com> wrote in message
news:11********************@z14g2000cwz.googlegrou ps.com...
Hi

Sometimes when i edit previously saved VBA code e.g. To update field
names etc the revised code does not work.
Even if i copy and paste in a previous version it does not work.

The only solution seems to be to delete the existing code, re-type ir
word for word and hey presto it works.

Of course you might think typo or something but its like Access seems
to totally ignore the code.

This may sound daft but its like Access seems to have a memory of
previously typed code and it seems to be remember the earlier code and
does not 'want' to process the new stuff.....

Am i imagining this or is there something I need to do?

I created stacks of functions a few months ago. Some of the field
names have changed and I updated both the query and the function for
the new code. Access rejected it. My only solution was to delete that
module and re-key the code again.

Any suggestions

chris

Nov 13 '05 #2
AFKAFB wrote:
Hi

Sometimes when i edit previously saved VBA code e.g. To update field
names etc the revised code does not work.
Even if i copy and paste in a previous version it does not work.

The only solution seems to be to delete the existing code, re-type ir
word for word and hey presto it works.

Of course you might think typo or something but its like Access seems
to totally ignore the code.

This may sound daft but its like Access seems to have a memory of
previously typed code and it seems to be remember the earlier code and
does not 'want' to process the new stuff.....

Am i imagining this or is there something I need to do?

I created stacks of functions a few months ago. Some of the field
names have changed and I updated both the query and the function for
the new code. Access rejected it. My only solution was to delete that
module and re-key the code again.

Any suggestions

chris

Perhaps this is a time when decompile might assist. Open the app with a
/decompile. EIther that or create a blank database and import all
objects as well as menus and imp/exp specs. Mayber there is something
that is in the system tables that needs to be corrected. THen rename to
new database to your app's mdb.
Nov 13 '05 #3
Salad
This is the first time i've heard of a decompile
Can you explain in a bit more detail how this works and how i start the
DB wih a /decompile.
regards
chris

Nov 13 '05 #4
On 21 Aug 2005 13:52:52 -0700, "AFKAFB" <ch***********@rbos.com>
wrote:

Create a shortcut on your desktop that points to:
<path_to>msaccess.exe <path_to>your.mdb /decompile

-Tom.

Salad
This is the first time i've heard of a decompile
Can you explain in a bit more detail how this works and how i start the
DB wih a /decompile.
regards
chris


Nov 13 '05 #5
Tom
Can you please let me know in more detail what a decompile will do
chris

Nov 13 '05 #6
Good idea to be cautious: while decompiling is a powerful tool, it's also
capable of causing problems.

Take a look at what MichKa has to say about decompiling at
http://www.trigeminal.com/usenet/usenet004.asp

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"AFKAFB" <ch***********@rbos.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Tom
Can you please let me know in more detail what a decompile will do
chris

Nov 13 '05 #7
Br
AFKAFB <ch***********@rbos.com> wrote:
Hi

Sometimes when i edit previously saved VBA code e.g. To update field
names etc the revised code does not work.
Even if i copy and paste in a previous version it does not work.

The only solution seems to be to delete the existing code, re-type ir
word for word and hey presto it works.

Of course you might think typo or something but its like Access seems
to totally ignore the code.

This may sound daft but its like Access seems to have a memory of
previously typed code and it seems to be remember the earlier code and
does not 'want' to process the new stuff.....

Am i imagining this or is there something I need to do?

I created stacks of functions a few months ago. Some of the field
names have changed and I updated both the query and the function for
the new code. Access rejected it. My only solution was to delete
that module and re-key the code again.

Any suggestions

chris


Have you tried saving the form under a different name, delete the old
one and rename the new one?

Do you have AutoNameCorrect turned on? Try turning it off.

Access holds two versions of the code. The script and the compiled code.
Sounds like the compiled version isn't being updated properly?

The /decompile command line option may help (eg.MSAccess.exe my.mdb
/decompile), or create a blank DB and import all your objects into it.
Could be a corrupted database. (Backup first obviously)
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #8
Bradley
You've said something which has sparked a thought.
When i use the Performance Analyser the first comment is that the
Application has not been saved in a compiled state. Is this any help?

To answer your questions - i've done as suggested re changing and
deleting the form - no effect.

Why would AutoCorrect affect this ? It happens to be switched on at
the moment.

I assume the script code is the version i've created and the compiled
code reads from this and stores it elsewhere. Where can you view the
compiled code?

I created a shortcut as suggested - it read something like "C:\MS
Office\1033\Access.exe" "r:\location\application.mdb/decompile"

where location was the drive name

Access came back with a message it could not find my DB :
"r:\location\application.mdb/decompile.mdb"

But i never typed "decompile.mdb" - any ideas??

I think my DB is corrupt - as it does things it should not do whereas
other queries etc are fine - it has me stumped.

Unfortunately i'm not sure how far back the corruption goes and whilst
i have loads of back up copies i cannot be certain how far back i've
been corrupted...

help

chris

Nov 13 '05 #9
"AFKAFB" <ch***********@rbos.com> wrote
Sometimes when i edit previously saved VBA code e.g. To update field
names etc the revised code does not work.

This problem is also sometimes evident when you add a field to an existing
form; the new field name does not show in Intellisense and may not be
recognized by VBA code. Decompile does not fix this.

What has worked for me in every case so far is to remove the form's Record
Source, save the form, and then put the form's Record Source back the way it
was.
--
Darryl Kerkeslager

Power corrupts.
Absolute power corrupts absolutely.
Knowledge is power.
See www.adcritic.com/interactive/view.php?id=5927
Nov 13 '05 #10
AFKAFB wrote:
Why would AutoCorrect affect this ? It happens to be switched on at
the moment.


Auto corrupt is a feature I've been turning off on every new mdb I make
since I began using A2003 and read Allen Browne and others' advice on it.

It may well be a good idea for you to do what Salad suggested and create
a new mdb and make sure autocorrect is turned off. Then use the get
external data to bring the stuff from your current mdb into it.

I'm not sure if a decompile would be necessary after doing this, but I
don't think it will hurt (notwithstanding Doug's caution). I find A2003
creates enormous mdb files and the decompile and then a compact helps me
get things down to a manageable level. I've done some very involved
apps in A97, for example, that never exceeded 5 megs in size. In A2003,
I'm lucky to get anywhere near this size, though the big front enc app
I'm working on presently is the largest I've ever done.

I also second Darryl's advice, I've run into irritating problems like he
describes many times in the versions of Access I've used.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #11
AFKAFB wrote:
Bradley
You've said something which has sparked a thought.
When i use the Performance Analyser the first comment is that the
Application has not been saved in a compiled state. Is this any help?

To answer your questions - i've done as suggested re changing and
deleting the form - no effect.

Why would AutoCorrect affect this ? It happens to be switched on at
the moment.

I assume the script code is the version i've created and the compiled
code reads from this and stores it elsewhere. Where can you view the
compiled code?

I created a shortcut as suggested - it read something like "C:\MS
Office\1033\Access.exe" "r:\location\application.mdb/decompile"

where location was the drive name

Access came back with a message it could not find my DB :
"r:\location\application.mdb/decompile.mdb"

But i never typed "decompile.mdb" - any ideas??
YOu need to insert spaces between switches. Ex: To open the app
exclusive and then decompile. The switches are not contained in quotes.

"C:\MSOffice\Access.exe" "r:\application.mdb" /decompile /excl
I think my DB is corrupt - as it does things it should not do whereas
other queries etc are fine - it has me stumped.

Unfortunately i'm not sure how far back the corruption goes and whilst
i have loads of back up copies i cannot be certain how far back i've
been corrupted...

help

chris

Nov 13 '05 #12
Hi
Bradley noted
"Access holds two versions of the code. The script and the compiled
code.
Sounds like the compiled version isn't being updated properly? "

My question is I assume the script code is the version i've created and
the compiled
code reads from this and stores it elsewhere. Where can you view the
compiled code?

Also how do you re-compile code?

chris

Nov 13 '05 #13
"AFKAFB" <ch***********@rbos.com> wrote in
news:11**********************@f14g2000cwb.googlegr oups.com:
Bradley noted
"Access holds two versions of the code. The script and the
compiled code.
Sounds like the compiled version isn't being updated properly? "

My question is I assume the script code is the version i've
created and the compiled
code reads from this and stores it elsewhere. Where can you view
the compiled code?
You can't, and you're never supposed to be able to.

Read the article my Michael Kaplan that Doug cited
(http://www.trigeminal.com/usenet/usenet004.asp). He explains the
"11 states of compilation" that are involved behind the scenes with
all your VBA code.

You only have access to the canonical code that you type.

Theoretically, when you change the code, the next time it compiles,
it will update the compiled code to reflect the changes in the code
you typed. However, this doesn't always happen, and the result can
be code that doesn't do what you expect, invalid code that doesn't
report compile errors or code-bearing objects that are corrupted and
won't open or cause Access to crash.
Also how do you re-compile code?


On the debug menu, there should be a command for compiling code.
Before Access 2000, you could compile the open modules, or compile
all modules, or compile and save all modules. But with the new
monolithic save model implemented in A2K, that is no longer
possible, and all you have is the choice to compile the whole
project. I add this command button to my code window toolbar,
because it's imortant to force compile code often in A2K.

Also, you should go to the options for code and turn off COMPILE ON
DEMAND. What this does is reduce the number of non-requested
compiles.

But, keep in mind that any code that is called and is not compiled
will be compiled on the fly in an attempt to run it. Code-bearing
objects can open and run in an incompletely compiled state.

If you use any significant amount of code, you should definitely be
compiling your project to make sure you don't have compile errors.

You also want to be sure that all of your modules have OPTION
EXPLICIT as the second line of them (this was not the default in
A2K, in a stupid move to make A2K foolishly consistent with Word and
Excel code modules). There is also an option to set to insure that
all your modules from here on out get created with OPTION EXPLICIT.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #14

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

Similar topics

53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
13
by: Mike Qin | last post by:
Hi there, Now I'm writing code mainly in C++. And some existing c code will call some functions which are in a C++ class. I read the basic techniques introduced from a SUN's web site. Basically...
2
by: Megan | last post by:
Can you write conditional VBA code that affects only one or two records on a continuous subform? I have a form with a subform on it. The parent/ child field that links the forms is CaseID. The...
3
by: Sai Kit Tong | last post by:
I posted for help on legacy code interface 2 days ago. Probably I didn't make it clear in my original mail. I got a couple of answers but none of them address my issues directly (See attached...
15
by: Bryan | last post by:
I have a multi-threaded C# console application that uses WMI (System.Management namespace) to make RPC calls to several servers (600+ ) and returns ScheduledJobs. The section of my code that...
2
by: Vikram | last post by:
Hi, I need some advice on making the choice for a good code obfuscator. I have looked at Dotfuscator from Preemptive. Some of the disadvantages they list with their dotfuscator product are: ...
245
by: Vortex Soft | last post by:
http://www.junglecreatures.com/ Try it and tell me what's happenning in the Microsoft Corporation. Notes: VB, C# are CLS compliant
8
by: George Meng | last post by:
I got a tough question: The backgroud for this question is: I want to design an application works like a engine. After release, we can still customize a form by adding a button, and source code...
4
by: Newbie19 | last post by:
I've searched a few websites and none of them meantion how to break up really long lines of code like a sql query. The sql statement looks like this (I've broked it down so it can fit in the...
4
by: =?Utf-8?B?dmlwZXJ4MTk2Nw==?= | last post by:
We are having an issue with an application we are developing. We have a Legacy COM DLL in C++ that we have converted to Visual Studio 2008. This COM DLL has methods that are calling Managed C#...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.