Computer Learning Zone CLZ Access Excel Word Windows

Upon the subject of education... I can only say that I view it as the most important subject which we as a people may be engaged in.

-Abraham Lincoln
Home   Courses   Seminars   Templates   Help   TechHelp   Forums   Contact   Join   Order   Logon  
OK, I fixed it
By Richard Rost   Richard Rost on Twitter Richard Rost on LinkedIn Email Richard Rost   9 years ago

I was finally able to recreate the problem that has been plaguing a few users for a while now. When you sign up for emails to tell you that the Forums or News Feed (what you're reading now) have been updated, you get a link to click on to come directly here (or to the Forum in question). That link could sometimes freeze and take MINUTES to load, and even then display gibberish.

Well, I finally figured out what the problem is. It was a programming conflict caused by yours truly which involves laziness, shortcuts, and having web site code that's been copied, pasted, and crossed like lights on a Christmas tree.

For those of you who don't care about programming, rest assured the problem has been fixed.

For the rest of you, here's a teaching moment...

I have a global function called MakeLogEntry() which is #included in the ASP of just about every page on my site. It allows me to create my own database log files. The IIS text logs are inadequate so I made my own. In any case, this function works great 99.999% of the time.

However... since I've recently been moving things around, changing code on the fly, yadda yadda yadda... a problem came up where I ended up accidentally having multiple conflicting recordsets loading on the same page. This would ONLY happen if the new user logon code tried to pull up your user record AT THE SAME TIME as trying to save your automatic login attempt to the log file.

Oops. This caused an endless loop and a gibberish recordset to try and display garbage until the script timed out... at about 2 minutes.

Once I discovered the problem it was an easy fix. HOWEVER, this problem wouldn't happened in the first place if I had just not been lazy and properly DIMmed my variables in my functions. See the function looks kind like this:

Function MakeLogEntry(SomeStuff)
set conn = ... database connection
set rs = ... recordset
record the data
set rs = nothing
set conn = nothing
End Function

OK, that's all fine and dandy, but if you don't DIM your variables INSIDE the function, ASP/VB assumes that if the variable already exists on the page that you want to use THAT variable. So when my function code is #included inside another page, if there's already a CONN or RS variable (which there was in this case) it uses those... then destroys those (=Nothing) and that caused the problem.

All I had to do was add one line of code to fix the problem:

Dim Conn, rs

And now those are LOCAL variables inside the function. The other recordsets on the page don't have a cow, and all is well with the world. See... being a lazy programmer WILL come back to bite you in the ass.

Thanks to Chris, Willem, Phillip, Alex, and everyone else who helped me to nail down this problem! You guys are the best.

OK I fixed it Upload Images   Link  
Kevin Robertson 
9 years ago
Kinda reminds me of the time I found six bug in one of my databases all at once lol - first five were easy to figure out, the last one took a while .... but never mind :D
Add a Reply
OK I fixed it Upload Images   Link  
James F 
9 years ago
Hi Richard,
How much longer until the searching seminar

Reply from Richard Rost:

It'll be done when it's done. :)

I'm on lesson 12 now and I'm probably a little more than half finished with it. If nothing else breaks on the web site, shouldn't be much longer now. Read More...
Add a Reply
OK I fixed it Upload Images   Link  
Richard Rost 
9 years ago
And you see, it's little things like this that cause me to take FOREVER to record classes. I just spent about 4 hours tracking this down. It needed to be done... but still...
Add a Reply

Show Older Comments...
View in Table Format

Start a NEW Conversation
Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.

Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Account Login
Online Theater
Lost Password
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Customer Support
Web Site Tour
Consulting Services
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Contact Info
Support Policy
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Blog RSS Feed    Twitter

YouTube Channel    LinkedIn