473,785 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Entering A Transaction

I have a transactions table with a field named Transaction. I want Transaction
to be positive for input and negative for outflow. How do I set up the form for
entering outflow so for data entry, the value is entered as a positive number,
is stored as a negative number and when the form is opened to the same record it
displays a a positive number. Is the form based on a query and if so what does
the Transaction field in the query look like?

Thanks!

Rose
Nov 13 '05 #1
2 1586
A very simple way to do this is to add another field called (say) Multipler,
type Number, size Long Integer, Required, Validation Rule:
1 or -1

Add a text box to both forms. On one form, set the text box's Default Value
to 1, and on the other form -1. You can set the Visible property to No on
both forms, but the Default Value ensures that right value is assigned when
new records are entered into the form.

The RecordSource for both forms is a query statement:
SELECT * FROM MyTable WHERE Multipler = 1;
SELECT * FROM MyTable WHERE Multipler = -1;
and that loads the desired records into each form.

You can now sum the Amount field like this:
Sum([Multipler] * [Amount])
to get the desired result.

A side-effect of this design is that it is actually possible to put a
reversal entry through, i.e. you can use a negative Amount in either form.
In some designs that's very desirable; if you don't want that to occur, use
a Validation Rule on the Amount field of:
=0
There are other ways to approach this issue. For example, you can make a
text box default to negative by examining its Text property in its
AfterUpdate event, and if the first character is not a sign ("+" or "-")
then negate its value.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Rose" <ro*******@eary hlonk.net> wrote in message
news:Mw******** *********@newsr ead2.news.atl.e arthlink.net... I have a transactions table with a field named Transaction. I want Transaction to be positive for input and negative for outflow. How do I set up the form for entering outflow so for data entry, the value is entered as a positive number, is stored as a negative number and when the form is opened to the same record it displays a a positive number. Is the form based on a query and if so what does the Transaction field in the query look like?

Thanks!

Rose

Nov 13 '05 #2
Allen,

Thanks for the prompt response! Works perfect!

Rose
"Allen Browne" <Al*********@Se eSig.Invalid> wrote in message
news:40******** **************@ per-qv1-newsreader-01.iinet.net.au ...
A very simple way to do this is to add another field called (say) Multipler,
type Number, size Long Integer, Required, Validation Rule:
1 or -1

Add a text box to both forms. On one form, set the text box's Default Value
to 1, and on the other form -1. You can set the Visible property to No on
both forms, but the Default Value ensures that right value is assigned when
new records are entered into the form.

The RecordSource for both forms is a query statement:
SELECT * FROM MyTable WHERE Multipler = 1;
SELECT * FROM MyTable WHERE Multipler = -1;
and that loads the desired records into each form.

You can now sum the Amount field like this:
Sum([Multipler] * [Amount])
to get the desired result.

A side-effect of this design is that it is actually possible to put a
reversal entry through, i.e. you can use a negative Amount in either form.
In some designs that's very desirable; if you don't want that to occur, use
a Validation Rule on the Amount field of:
>=0


There are other ways to approach this issue. For example, you can make a
text box default to negative by examining its Text property in its
AfterUpdate event, and if the first character is not a sign ("+" or "-")
then negate its value.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Rose" <ro*******@eary hlonk.net> wrote in message
news:Mw******** *********@newsr ead2.news.atl.e arthlink.net...
I have a transactions table with a field named Transaction. I want

Transaction
to be positive for input and negative for outflow. How do I set up the

form for
entering outflow so for data entry, the value is entered as a positive

number,
is stored as a negative number and when the form is opened to the same

record it
displays a a positive number. Is the form based on a query and if so what

does
the Transaction field in the query look like?

Thanks!

Rose


Nov 13 '05 #3

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

Similar topics

16
7522
by: noah | last post by:
Does PHP have a feature to associate Cookie sessions with a persistent database connection that will allow a single transaction across multiple HTTP requests? Here is how I imagine my process: I have an series of interactive HTML forms. The user begins a Cookie session. A database connection is opened and a transaction is begun. After the user goes through any number of pages where they update the database they finish on a page where...
10
13351
by: TZoner | last post by:
1) Can one find the location of the 'Transaction Log' at: <Hard Disk>\Program Files\Microsoft SQL Server\MSSQL\Data\MyDb_Log.ldf? 2) Is it safe to delete it, as SQL will create a new Transaction Log when it realises none already exist? 3) When trying to do 2) I get error message that file is in use, even though SQL Server is closed. Any suggestions? 4) Can anyone shed light on the error message 'Write on ... <my path
3
7576
by: Thiko | last post by:
Hi I take one nightly full database backup at 02:00 and backup the transaction log to one backup set every 15mins. The commands to do this are as follows and are set up to run as database jobs: -- Database Backup BACKUP DATABASE TO WITH NOINIT ,
2
2386
by: Deepak Mehta | last post by:
i have to update two tables from ASP pages with same data but i want that both of them should be updated at one time. If either of them is not updated then my transaction should roll back.I want this thing to be in a stored procedure. so that i have to write an execute statement only on the ASP page and pass the parameters. Looking forward for ur reply DEEPAK
1
439
by: Avanish Pandey | last post by:
Hello All We have 3 differen services (in 3 different server) Service A,B,C . We want to implement distributed transaction when call methods of B and C from A. Is it possible? if yes then how? I have read the doc regarding this: http://www.developer.com/net/asp/article.php/3385631 but it will not work when methods are in different services on
2
3896
by: John Lee | last post by:
Hi, I have few questions related to .NET 2.0 TransactionScope class behavior: 1. Check Transaction.Current.TransactionInformation.DistributedIdentifier to identify if distributed transaction is used - is it accurate way? 2. I have the following code blocks - In code block 1, the first check the DistributedIdentifier is ALL 0s so it
1
10385
by: Jason Huang | last post by:
Hi, I am just wondering how do we test the transaction's Commit and Rollback? How do we simulate a situation to let the transaction fail then Rollback? Thanks for help. Jason
15
10005
by: Zeng | last post by:
Hi, The bigger my C# web-application gets, the more places I need to put in the tedious retrying block of code to make sure operations that can run into database deadlocks are re-run (retried) 3-4 times and give up if after that it's still in deadlock. I'm very sure that many experienced people out there already deal with this issue somehow. Is there an alternative to it? Thanks for your comments and suggestions.
1
8340
by: Matik | last post by:
Hi to all, Probably I'm just doing something stupid, but I would like you to tell me that (if it is so), and point the solution. There ist the thing: I' having a sp, where I call other sp inside. The only problem is, the name of this inside sp is builded variously, and executed over sp_executesql:
0
9643
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
9480
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
10319
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...
1
10087
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,...
0
9947
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 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...
0
6737
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();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4046
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
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.