By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,210 Members | 1,486 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,210 IT Pros & Developers. It's quick & easy.

Rebuild Form From Scratch?

P: n/a
A couple of my forms may be corrupted. I am using ACCESS2000. I have
noticed that on a couple of forms, my computer's CPU usage hits 100%
and stays there. Running the compacting/repair tool only provided
temporary relief. These forms have been checked for "bad" code, but
none was observed, also these forms previously did not seem to eat-up
the CPU usage. I am assuming that the best strategy to solve this
problem would be to rebuild these forms from scratch. Any thoughts?

Feb 21 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You could try this:

Public Sub RenewObject( _
ByVal ObjectName As String, _
ByRef ObjectType As AcObjectType)
Dim TempName As String
Dim FileName As String
TempName = ObjectName & Format(Now(), "yyyymmddhhnnss")
FileName = TempName & ".txt"
' save this code before running

' make a safe copy of the object
DoCmd.CopyObject , TempName, ObjectType, ObjectName

' save the object as text
SaveAsText ObjectType, ObjectName, FileName

' load the object as text ... if corruption then error
' original object is OVERWRITTEN without warning
LoadFromText ObjectType, ObjectName, FileName

' remove text file
Kill FileName
End Sub

Sub test()
RenewObject "Form1", acForm
End Sub

Feb 21 '06 #2

P: n/a
no, I don't think rebuilign from scratch is needed here.
first, does the code compile..and can you create a mde file?

2nd...did you turn off the track-name autocorrect?

3rd...there was a ZILLION bug fixes included in the service packs for office
2000. Have you installed the updates?

And, another thing to check is there any timer function running?....often
people don't realize that the timer event for a form is set in
milli-seconds...

so, they enter 20...and that means every 20 millisencd the code will execute
(that is what..500 times a second???)....

So, check the above. I would first try this as a mde..and see if the problem
still exists.

Access97 used to always max out the cpu...and it was a known problem.
However, the windows tasking system would gracefully slice out the time
anyway..(in other words...while the CPU did show 100%...it does give up the
time slice anyway).

The above problem was fixed in a2000.....

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.members.shaw.ca/AlbertKallal
Feb 21 '06 #3

P: n/a
Thanks, using Access2000. On one form this problem appears to be fixed.
It has to do with the "stLinkCriteria" criteria being undefined. I
used the access wizard on a command button to open a new form (at least
that was the intent). The code should have had "acFormAdd" instead it
had "stLinkCriteria". Correcting the code to "DoCmd.OpenForm stDocName,
, , , acFormAdd" seems to have fixed it. I assume that the jump in CPU
usage was caused by Access searching for a value for "stLinkCriteria".
Now I need to check the other forms, when I get a chance, to see if a
similar fix can be applied. Unfortunately, I received a bunch of work
projects, so I will have to put fixing the program on the backburner
for a while.

Feb 22 '06 #4

P: n/a
Evidently, my belief that the problem may have been solved was
premature. Upon reopening the form to enter my work, the CPU usage
jumped back to nearly 100% occassionally, it would drop down to near
0%. Will have to check it out more.

Feb 22 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.