In the book “Access 2000 Developer’s Handbook Vol 1: Desktop Edition”, pages 221 & 222, it states the following:
“When you create an object variable, Access creates only a ‘pointer’. That is, the variable it creates refers to a real object; it’s not a real object itself. It contains not the value of the object, but its memory address instead.”
It then gives a number of examples:
Dim cnn as ADODB.Connection
Dim rst as ADODB.Recordset
Dim frm as Form
Dim ctl as Control
etc.
My question is:
If the variable is strictly a pointer (space for memory address) and since (I am assuming) the memory address is always the same size, why don’t we just code as follows:
Dim cnn as Object
Dim rst as Object
Dim frm as Object
Dim ctl as Object
etc?
I can understand the need for specific Set statements:
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset
Set frm = Forms(“frmCustomers”)
Set ctl = frm.Controls(“txtCompanyName”)
I can see the need to assign specific addresses. I can’t see the need to be specific when setting aside the neccessary space for an (any) address.
I am sure there are some who understand the nuts and bolts of this.
Just curious.