View Single Post
  #13  
Old November 17th, 2009, 02:55 AM posted to microsoft.public.access.forms
Scott_Brasted via AccessMonster.com
external usenet poster
 
Posts: 49
Default Using a Combo Box to Find Records

Bruce

My appoligies for being too sensitive. It has been a particularly bad couple
of weeks. I appreciate the thoughts on compiling. It makes good sense. It
amazes me that MS will write db's with code that does not compile. Also
thankyou for the idea on the close button. As I understand what you said, It
pays to be more specific in my code. What does the ac in acForm represent?

Thank you for all your help and patience.

Best,
Scott

BruceM wrote:
I didn't know you understood Jeanette's suggestion based on what you wrote.
You wouldn't be the first person attempting to use a placeholder field or
control name in actual code.

The ItemData code needs to go into the *form's* Load event. A combo box
doesn't have a Load or OnLoad event (at least not in Access 2003 and earlier).
Did that code compile?

When closing a form I like to be specific:
DoCmd.Close acForm, "frmCampaignSummary"

If you are closing the form on which the command button lives you can do:
DoCmd.Close acForm, Me.Name

I can't say exactly what compiling code does, except that it will identify
syntax errors, references to non-existent fields and controls (perhaps due to
spelling errors), functions with the wrong number of arguments (for instance,
Left("Test text") would generate a compile error because you need to specify
the number of characters), functions it doesn't recognize (again, spelling
errors perhaps). A database with uncompiled code could harbor an error. In
some cases this would be code that runs only when certain conditions are met,
so it could be a while before the error happens. I believe compiling
improves performance, but most of the time probably not enough to make much
of a difference.

As an aside, Option Explict is a good thing to have at the top. It means you
have to declare all variables. If you do not, Access tends to assume
anything it doesn't recognize is a variant, which can lead to very
frustrating troubleshooting just because you typed something incorrectly.
The difference between lngID and IngID may not be readily apparent by eye
(one uses a lower case "l" and the other an upper case "I", in case you are
viewing this with sans serif font).

Bruce,

[quoted text clipped - 58 lines]
Thanks,
Scott


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200911/1