Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Dumb Mistakes
Donald Blackwell 
       
16 months ago
Working on an import and sanitizing process for importing records from another source (after watching most of the Tech Help videos and through Developer 11) thinking "OK, this will be easy enough".

After many hours of coding a SQL statement in VBA with each field on a separate line for easier reading with line continuation ("stuff" & _), I get to field 19 of 22 and the Editor gives me "Too many line continuation..." So that was the first dumb mistake (I thought).

So, I went back and combined a few shorter lines.... All good, right? NOPE

First trial, the true First Dumb Mistake shows up, HINT: I'm not referring to the actual coding mistakes which will inevitably happen in any large project.

The REALLY DUMB MISTAKE: The SQL statement was one big line continuation, when Access encountered an error, the editor highlighted the ENTER 20+ lines of code.

I know, a noob mistake but, thought I'd share to maybe save other new vba users some time. I changed to "SQL = SQL &..." for each field so the editor could actually show me what was wrong.
Richard Rost  @Reply  
          
16 months ago
Yeah, I remember I had that problem when I started out too. Good you solved it though. :)

Honestly, if you're going to add that many fields to a table, you're better off with a Recordset. SQL statements are better for short stuff. IMO.
Donald Blackwell OP  @Reply  
       
16 months ago
Most of my experience come from web dev using PHP/MySQL so have always just built SQL statements. However, in this case, the "unsanitary" date gets pulled into an import table and the script I was working on in a first step "sanitizes" into a processing table before the next script breaks it down further into the normalized tables where it resides.. I'll probably eventually get to be a one step process but first just trying to get it right.

But I am using a recordset to pull the data from the import table... just still didn't think about creating a second rs to build the second process.. was just looping through creating the SQL statement then db.execute...

Thanks for the suggestion!
Thomas Gonder  @Reply  
      
16 months ago
@Donald B. While you're at it, create a few functions that "convert/sanitize" strings, dates and numbers, so you have an easy call in the various rs!data routines you will do over time. I used to get a lot of weird formats from different systems in my old application. I just kept adding code to the function to deal with the new ones.
John Davy  @Reply  
         
16 months ago
Hi Donald, I truly believe that we learn more through our mistakes than we do by not making them. I think of all the times in life when I said, "Wow, I'll never do that again!"  So, I learned a great deal and you learned a great deal about importing, exporting and SQL statements   John
Richard Rost  @Reply  
          
16 months ago
Yeah, I'd say about 75% of my personal knowledge is from trial and error. LOL
Donald Blackwell OP  @Reply  
       
16 months ago
Thanks everyone! I agree with each of you... Since I was still debugging the original script, I went ahead and changed from SQL statements to another recordset and came to another, IMO, valuable realization as well: Sometimes, too many comments can be just as bad as too few.

I know that the application I'm working on will evolve because I'm trying to get it running at bare minimum first* and then I can add features throughout its evolution. For that reason, I was commenting what each thing in the code was so I could remember when I come back to it. But there were so many comments, it was actually starting to make the code HARDER to read. By switching to the 2nd recordset for the insert and the table having better naming, I was able to eliminate a lot of comments because the code clearly speaks to what  it is, so thanks again Richard!!

Also, I completely agree. I learn a lot from all the classes (I'm through Developer 11 so far) and the Tech Help but just reading the posts in the forums is also invaluable as I've learned a lot from seeing the various suggestions to resolve other peoples' issues as well. That's actually why I started this post, figured maybe help someone avoid losing time on something so simple!

Thanks again everyone!!!
Thomas Gonder  @Reply  
      
16 months ago
@Donald Often, especially in Access, there is more than one way to skin a cat. We may try two or more methods. One is bound to be better in a given situation. More often than not, the error part might be with a bug in Access, which requires us to choose a less-than-optimal path.

A big one I can think of is allowing a form to run twice so a user can work on two records at once. One maybe for a customer task at hand and another for an interrupting customer phone call. Microsoft created a turd-plated solution with "instancing". Juan Soto pushes it as genius, but in my testing, it flat out fails miserably. Especially compared to fifty-year-old technology in Unix and other db systems.
Richard Rost  @Reply  
          
16 months ago
Thomas Gonder, I don't think instancing is turd-plated. It's not fantastic and it could be implemented better, but if you do it right it works well. I just covered it in Access Developer 47.
Thomas Gonder  @Reply  
      
16 months ago
@ Richard one of the many problems is that Access corrupts variables in one Instance from another instance. Also, when you close a form, it will close the wrong instance. Microsoft failed to implement sandboxing between the variable tables (why I say turd-plating), a very serious error. I've done bug reports on it, no response from Microsoft.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/2/2026 8:28:19 AM. PLT: 0s