Drew Wutka
DWUTKA at marlow.com
Tue Apr 1 14:58:17 CST 2003
Charlotte: To learn what in, Drew? Access VBA programming isn't the same as VB anyhow. Drew: The language is almost identical, you just have a different object model to deal with. Charlotte: That's like saying that programming Word and Access is the same, you just have a different object model to deal with! <vbg> Okay, above is the initial start of this 'thread'. Actually, not understanding the PRINCIPLES of VB/VBA will get you no where. There is a difference between 'generic' programming and the principles of VB/VBA. Generic programming would be i=i+1. That's a simple line of code, to increase the value of i by 1. However, the a principle would be understanding things like 'If i=1 then' means that it is only 'checking' the value of 1. In some languages, 'If i=1 then' would have i=1 after the check...you would need to use 'If i==1 then' instead. Or understanding that ByRef is the default for a function/subs arguments. Understanding how VB/VBA is single threaded, and what that implies, including what DoEvents does. These are all principles that must be understood to effectively program VB/VBA. I actually started with Access, and I wouldn't consider myself strictly VB now either. I develop in VB, Access, (some excel), ASP, etc. You know, I had to pick up QVBasic, which is a proprietary language for an inspection machine we have. QVBasic is VERY similar to VBScript. In fact, almost all commands are identical. There are two primary differences. One, you can dimension a variable to a particular type. (Can't do that in VBScript), and also you have a special 'object model' that allows you to interface with the machine. That is similar to ASP. ASP IS (no if's and's or but's) VBScript. However, it has the ASP object model, which contains several components. Also, some normal VBScript code won't work. Not because ASP isn't VBScript, but because of the platform ASP is run in. (ie, CreateObject commands must be done with the ASP Server object, because the object needs to be created within the context of the IIS server). There are definite differences between VB and VBA. I am not arguing that at all. However, VBA within any of the Office programs is EXACTLY the same (as long as you are in the same 'family', ie, Access 2000 and Excel 97 are not the same (6.0 versus 5.0). I am not saying that learning the intrecacies of the object model is not important. What I AM saying is that if you don't understand the principles of VBA, then learning the object model is going to be much more difficult. Understanding what a property, a collection, and a method are, are key to understanding how a new object model works. (Oh yeah, and events.....) Just because you have a different 'default' object model (remember, you can use any office program object model within any other office program), does not make VBA different. Because if that was the case, VBA would not be the same from project to project within the same program. When you make a Class, you are creating an 'object model' (a simple one, but an object none the less). So the code used to interface with that class is going to be different from the code used to interface with a different class. Does that mean that it's a whole new language? Obviously not! Drew -----Original Message----- From: Charlotte Foust [mailto:cfoust at infostatsystems.com] Sent: Tuesday, April 01, 2003 2:18 PM To: accessd at databaseadvisors.com Subject: RE: [AccessD] VBE I understand how you feel, Drew. But my point is that just understanding generic VB/VBA programming is not going to get you anywhere at all when you need to understand the particular object model involved. You are dealing primarily with VB, not with the Access interface objects, so it's very easy for you to say how "similar" everything is. In fact, the object models for the interface objects are not similar at all. One handy example is the combobox in VB as opposed to the Access combobox. Sorry, Pal, but your argument doesn't hold water. :o} Charlotte Foust