Hi I'm working on the invoice customer form
and i had those text box :
txtarticle, txtPrice, txtAfterDiscPri ce, txtCashMoney
i want to write this code -
If (txtAfterDiscPrice is null) then txtCashMoney=txtPrice ;
-
else
-
txtCashMoney=txtAfterDiscPrice;
-
on the default value of the txtCashMoney.
-
so i wrote this on the default value of the txtCashMoney: -
= iif(isnull(txtAfterDiscPrice ) ,= [txtPrice] ,= [txtAfterDiscPrice ]
but it's not working does anyone know why ?
7 4072 NeoPa 32,579
Recognized Expert Moderator MVP
If the names and references are right then you could try : - =Nz([txtAfterDiscPrice],[txtPrice])
The problem I see in this line of code would be the formating. In true / false criteria you don't need the "=", try that again with the "=" removed: - [txtCashMoney]= iif(isnull([txtAfterDiscPrice] ,[txtPrice] ,[txtAfterDiscPrice])
Colintis,
Closing brackets is missing and a few corrections.. Though this is a replica of Post#2. For correction sake.. - = IIf(IsNull([txtAfterDiscPrice]) ,[txtPrice] ,[txtAfterDiscPrice])
Oops...Thanks for that one Jerry :P
Well i tried this one it wont give me errors but nothing happened the field CashMoney still empty :(
maybe i should do this with an event like jim told me
Take note that if txtPrice or txtAfterDiscPri ce have null/no values then you might see empty space in CashMoney field. Apart from this I am sure that NZ and IIf..IsNull functions of the previous posts should work perfectly.
Just like you proposed .
Try this on the On_Current event of the form. - If IsNull(txtAfterDiscPrice) then
-
me.txtCashMoney=txtPrice
-
else
-
me.txtCashMoney=txtAfterDiscPrice
-
end if
NeoPa 32,579
Recognized Expert Moderator MVP
You say you've "tried this one", but there are three suggestions you could be referring to. I have no idea what you have and haven't tried so I am not in a position to help at this time.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: ago |
last post by:
Is it possible to have a default value associated python objects? I.e.
to flag an attribute in such a way that the assignment operator for the
object returns the default attribute instead of the object itself, but
calls to other object attributes are properly resolved? (I don't think
so, but I am not sure)
Example:
class obj(object):
x=1 #assume x is somehow made into a default value
|
by: Ian D |
last post by:
Firstly apologies for the convoluted question. I found this problem whilst
building a larger database. I've distilled it down to as small as possible
and can send a 200k example to anyone who has the time to have a play.
Am I doing something silly or is this an Access problem (or other)?
Access 2000
3 tables
tblID contains ID (autonumber), Data (text)
tbl1 contains ID (Number, default = nothing, Primary Key), bool1 (yes/no)
|
by: Justin |
last post by:
Is there any way to prevent VB.net to give default value to a variable
(changing settings what not...)?
For example
Dim test As Integer
test = test + 1
the statement "test = test + 1" should give me an error since variable test
|
by: Bob |
last post by:
I have a CreatedOn field , datetime, which has GetDate() as the default
value in SQL server 2000 table. When I create a new record in the table
itself in enterprise manager, the field gets populated OK, but when I try to
create a new record with a Microsoft datagridview control, I notice that the
datecreated value does not get created. It looks as if the datagridview
insert statements overrides the default value and prevent the default...
|
by: Brad Baker |
last post by:
I have an asp.net/csharp application that requires a particular variable to
work properly. This variable is usually passed via a query string in the URL
when the application is first run but under certain circumstances the query
string may not contain the variable. So I need some way of establishing a
default value if one isn't set.
Is there some way I can set a query string on page_load OR is there some way
I can use a global variable...
| |
by: EJO |
last post by:
I've looked around the groups and don't have tried some of the various
suggestions to no avail. So I'm hoping someone can help me out here.
I have a form that, when a cmd button is clicked, changes the property
of the form to dataentry. On this form, there are two fields that
have a default value set. The one default value set using the
property sheet is getting the value from a numeric field on a
different form and is working just...
|
by: Macneed |
last post by:
i am a newbie,
i remember i read a book talking about when u declare a array variable
using
float ABC = new float;
the whole array element in ABC ( ABC to ABC ) will automatic
initialize to 0
and all type of numeric variable is initialize to 0, bool type is false,
is it true?
|
by: kenneth |
last post by:
Dear all,
I have encountered this weird problem.
I have a class definition with an __init__ argument 'd'
which defaults to {}. This argument is put in the 'self.d'
attribute at initialization
I create two independent instances of this class; the code
is as follows.
|
by: lawpoop |
last post by:
I'm trying to write some simple code, but I might be simplifying it
too much.
I have a function that either returns a string that I want, or FALSE.
In the code that I'm working on, I would like to default to another
string if the function returns false.
Here's the long way to do it:
$string = myFunction(2);
|
by: topher23 |
last post by:
Disclaimer: I've already come up with a solution for this issue, but I thought I'd post it in the hope that it could help someone else and on the off chance that someone has another solution.
I have a form for machine operator tracking. The form shows training-stage tracking dates with a lot of performance information. On the form is a subform for reviews, which uses a set of unbound text boxes to show current data for a review, which is...
|
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...
| |
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,...
|
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...
|
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,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
| |
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |