473,467 Members | 1,487 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Concept Question

I am having a conceptual problem.
When working with a forms & Code sections which is correct method and how do
they differ when working with fields?
Code
Private Sub CExt1_BeforeUpdate(Cancel As Integer)
Me!CExt1 = Nz([CDoz1], 0) * Nz([CPrice1], 0) ; this one?
CExt1 = Nz([CDoz1], 0) * Nz([CPrice1], 0) : Or this?
End Sub

Form Control Source
CExt1 = Nz([CDoz1], 0) * Nz([CPrice1], 0) Or is this correct way
to do it?
My problem is when do you use the Me! with a field and when is it not
needed. Or just what the heck is the concept behind them...

Thanks,

JC
Nov 12 '05 #1
2 1488
Some of it is personal preference. Using Me makes it a little more apparent
when reading the code that it is an item on the form/report, not just a
variable. This would be similar to putting "int" on the front of an integer
variable (i.e. intMyVariable). It will also sometimes remove problems if you
have duplicate names because it pins down which item you are referring to;
however, it is better to remove the duplicate names.

As far as placing the equation in the control source, if you do that you now
have a calculated control that the user can't type information into. If
that's what you're after, then that's probably the better way. If you want
the control to be a bound control and you want to change it programmatically
also, then you can't put the equation in the control source. By the way, I
don't know if you just did this for the message or not, but if it is put in
the control source, the name of the control on the left side of the equal
sign isn't entered, it automatically refers to the control whose control
source it is in.

Example:
CExt1 = Nz([CDoz1], 0) * Nz([CPrice1], 0) Change the above to
= Nz([CDoz1], 0) * Nz([CPrice1], 0)
When placing it in the control source of the control CExt1. Also, Me won't
be recognized here.

--
Wayne Morgan
Microsoft Access MVP
"JC Mugs" <jc****@hotmail.com> wrote in message
news:10*************@corp.supernews.com... I am having a conceptual problem.
When working with a forms & Code sections which is correct method and how do they differ when working with fields?
Code
Private Sub CExt1_BeforeUpdate(Cancel As Integer)
Me!CExt1 = Nz([CDoz1], 0) * Nz([CPrice1], 0) ; this one?
CExt1 = Nz([CDoz1], 0) * Nz([CPrice1], 0) : Or this?
End Sub

Form Control Source
CExt1 = Nz([CDoz1], 0) * Nz([CPrice1], 0) Or is this correct way to do it?
My problem is when do you use the Me! with a field and when is it not
needed. Or just what the heck is the concept behind them...

Thanks,

JC

Nov 12 '05 #2
"JC Mugs" <jc****@hotmail.com> wrote in
news:10*************@corp.supernews.com:
I am having a conceptual problem.
When working with a forms & Code sections which is correct method and
how do they differ when working with fields?
Code
Private Sub CExt1_BeforeUpdate(Cancel As Integer)
Me!CExt1 = Nz([CDoz1], 0) * Nz([CPrice1], 0) ; this one?
CExt1 = Nz([CDoz1], 0) * Nz([CPrice1], 0) : Or this?
End Sub

Form Control Source
CExt1 = Nz([CDoz1], 0) * Nz([CPrice1], 0) Or is this correct
way to do it?
My problem is when do you use the Me! with a field and when is it not
needed. Or just what the heck is the concept behind them...

Thanks,

JC


I almost always use

Me.NameofControl.Value

Is it slower? I'm not sure. Does it remind me that I am dealing with a
control property of the form? Yes. Can I find it in Intellisense? Every
Time.

I am also careful to name my controls with prefixes, txt, cmd, lst, cbo etc
and to be sure that their names are distinct from any fields to which they
may be bound. I name their labels by replacing the prefix with lbl. So
typically, a control lonked to a field called fldFirstName is called
txtFirstName and its label is called lblFirstName.

For fields in the recordsource I wish to use but not see, I create hidden
controls, and name and point to them in the same way.

I haven't used a bang in a very long time.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matthew Louden | last post by:
I want to know if the PostBack concept applies to HTML web-based forms, regardless of what programming technologies we use: For example, ASP, ASP.NET, Java, CGI, etc... PostBack means to send...
1
by: googleo | last post by:
Hi, in my application I want to handle and store data in a hierarchic data structure. For example: persons who manage houses; houses have various numbers of floors; floors have various numbers...
6
by: Sergey | last post by:
Hello! Could anybody be kind enough to explain this concept? Why C++ make two ops for prefix and postfix ++ operator? As I guess, it is possible to implement both cases via sole prefix...
4
by: cmc | last post by:
I need some clarification to help me understand the DB2 strucure more. The questions are about "implicit schema" 1. This is a very interest concpet that DB2 let every user to create new schema...
4
by: jm | last post by:
Consider: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconwhenshouldiimplementinterfacesinmycomponent.asp // Code for the IAccount interface module. public...
5
by: strutsng | last post by:
I want to clarify the concept of submitting the form to the web server. PHP is just an example here, it applies to any web programming languages. On page1.php, <form name="myform"...
20
by: Stan Sainte-Rose | last post by:
Hi, Sorry about this newbie question, but I have some questions about the MDI Concept. I have a MdiParent form that calls a Child Form (A). This Child Form (A) could call another Form (B). ...
2
by: developer.new | last post by:
Hi I have a question regarding this concept I learned about recently: Name Hiding. Here's what I've come across: There is a base class with two functions with the same name but different...
2
Subsciber123
by: Subsciber123 | last post by:
I am writing a program to create family trees. It is stable, but I would say that it is still in the pre-alpha stage. Anyway, I would like to be able to export the tree to a concept map. Does...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.