473,602 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ 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_BeforeUpd ate(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 1495
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 programmaticall y
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.supe rnews.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_BeforeUpd ate(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.supe rnews.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_BeforeUpd ate(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.NameofContro l.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
11097
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 the HTML form to the web server? Since most of the time I heard this term in ASP.NET circle, thats why I raise this question. Please advise. Thanks!
1
1998
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 of rooms etc. My first concept is to use a tree structure, to ideally save the whole tree to file and load from file.
6
2242
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 increment operation. Correct me if I'm wrong, Let's see trival example:
4
2613
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 (as this is part of the PUBLIC group privilege - if I am not wrong). From a practical stand point, what is the application of such concept. 2. Suprisingly, if the schema is an implicitly created, everyone else can create objects in it too. What...
4
8575
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 interface IAccount { void PostInterest(); void DeductFees(IFeeSchedule feeSchedule); }
5
1361
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" action="otherpage.php" method="post"> means 2 steps here: 1) submit the form called "myform" on page1.php to the web server using HTTP POST method.
20
1242
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). Example. My main Form is the MDI Parent Form. I have a button that launches a Customer Listing (Child Form A).
2
4840
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 signature. A class inherits publicly from this base class and redefines one of the two functions in the derived class. In that case, a derived class object cannot access the other base class function that it hasn't redefined. I'm posting a code snippet...
2
2711
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 anybody know of either a module in python that supports making concept maps or a program that stores its concept maps in an easily duplicable xml format? Any code that anybody has written in python that is relevant in the slightest to creating a concept...
0
7993
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8404
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8054
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2418
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 we have to send another system
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.