referencing records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was looking for a fix on a problem I am having regarding the Current
Record and opening a new Form, when I read something regarding the Primary
Key. The posting used

Me.[ID]

to reference the Primary Key. Now, I have a field named "ID" which is used
as the Primary key.

Have I created problems for myself by calling the Primary Key "ID"?
 
I was looking for a fix on a problem I am having regarding the Current
Record and opening a new Form, when I read something regarding the Primary
Key. The posting used

Me.[ID]

to reference the Primary Key. Now, I have a field named "ID" which is used
as the Primary key.

Have I created problems for myself by calling the Primary Key "ID"?

Not at all, though perhaps a field name of ClientID (if it was for the
Clients table) would be more descriptive.
The field name in this instance happens to be [ID].

The use of Me.[ID] is the shorthand code equivalent of using
forms!FormName![ID] (where FormName is the name of the form and ID is
the name of the control on the form).
Me! always refers to the same object (form or report) that the code is
in. So Me![EmpolyeeName] is the same as forms!FormName!EmployeeName if
written in the FormName class code window.
 
Thanks for the quick response.
This clarified some of the things that were fuzzy (I've been using VBA Help
and this site to teach myself).

I was looking for a fix on a problem I am having regarding the Current
Record and opening a new Form, when I read something regarding the Primary
Key. The posting used

Me.[ID]

to reference the Primary Key. Now, I have a field named "ID" which is used
as the Primary key.

Have I created problems for myself by calling the Primary Key "ID"?

Not at all, though perhaps a field name of ClientID (if it was for the
Clients table) would be more descriptive.
The field name in this instance happens to be [ID].

The use of Me.[ID] is the shorthand code equivalent of using
forms!FormName![ID] (where FormName is the name of the form and ID is
the name of the control on the form).
Me! always refers to the same object (form or report) that the code is
in. So Me![EmpolyeeName] is the same as forms!FormName!EmployeeName if
written in the FormName class code window.
 
Back
Top