this is my code, it is updating QTY on Hand when you make a new sale or
if you got some product returned. Now as it is updating QTY when qty
textbox lost focus if some one is going through records and whenever
this qty text box will losee focus it will be fired and change the
quantity in the product table. I want it, to be fired only ig user
clicks qty text box or only if new record is inserted.Can you help.
Private Sub qty_Click()
On Error GoTo Err_qty_Click
Dim TotalQty As Integer
TotalQty = 0
Product = Forms![frmSale]![tblSaleDetail*]![Product]
TotalQty = DLookup("[QtyOnHand]", "[Products]", "[ProductID]=" &
Product)
If (TotalQty - [qty]) < 1 Then
MsgBox "Inventory Below 0. Quantity Issued is To High!"
Exit Sub
End If
TotalQty = TotalQty + [qty]
DoCmd.SetWarnin gs False
DoCmd.RunSQL "UPDATE [Products] SET " & _
" [Products].[QtyOnHand] = " & TotalQty & _
" WHERE [Products].[ProductID] =" & [Product]
DoCmd.SetWarnin gs True
Exit_qty_Click:
Exit Sub
Err_qty_Click:
MsgBox Err.Description
Resume Exit_qty_Click
End Sub
Private Sub qty_LostFocus()
On Error GoTo Err_qty_LostFoc us
Dim TotalQty As Integer
TotalQty = 0
Product = Forms![frmSale]![tblSaleDetail*]![Product]
TotalQty = DLookup("[QtyOnHand]", "[Products]", "[ProductID]=" &
Product)
If (TotalQty - [qty]) < 1 Then
MsgBox "Inventory Below 0. Quantity Issued is To High!"
Exit Sub
End If
TotalQty = TotalQty - [qty]
DoCmd.SetWarnin gs False
DoCmd.RunSQL "UPDATE [Products] SET " & _
" [Products].[QtyOnHand] = " & TotalQty & _
" WHERE [Products].[ProductID] =" & [Product]
DoCmd.SetWarnin gs True
Me.subtotal = Me.qty * Me.SalePrice
Exit_qty_LostFo cus:
Exit Sub
Err_qty_LostFoc us:
MsgBox Err.Description
Resume Exit_qty_LostFo cus
End Sub 5 1648
"khan" <ah******@gmail .com> schreef in bericht
<everything snipped>
Check out: http://www.allenbrowne.com/AppInventory.html
Btw:
I could swear I saw an identical message from you some hour ago.
Please try to be a bit more patient...
Arno R
"Arno R" <ar***********@ tiscali.nl> wrote in message
news:42******** *************@d reader2.news.ti scali.nl...
"khan" <ah******@gmail .com> schreef in bericht
<everything snipped>
Check out: http://www.allenbrowne.com/AppInventory.html
Btw:
I could swear I saw an identical message from you some hour ago.
Please try to be a bit more patient...
Arno R
This guy is obviously too busy to check out external links. He does not
seem to be looking for a deeper understanding of Access, just some geeky
nerd who will re-write his code for free... and wait ... someone probably
will.
"Arno R" <ar***********@ tiscali.nl> wrote in message
news:42******** *************@d reader2.news.ti scali.nl...
"khan" <ah******@gmail .com> schreef in bericht
<everything snipped>
Check out: http://www.allenbrowne.com/AppInventory.html
Btw:
I could swear I saw an identical message from you some hour ago.
Please try to be a bit more patient...
Arno R
This is the same guy that repeatedly posted the same message last week. The
"r u crazy" and "I swear to god" guy. He's doing it again.
"Randy Harris" <ra***@SpamFree .com> schreef in bericht news:9Y******** *******@newssvr 19.news.prodigy .com... This is the same guy that repeatedly posted the same message last week. The "r u crazy" and "I swear to god" guy. He's doing it again.
Hi Randy,
I did recognize him ... I was just trying the 'more friendly' approach.
BUT, nothing works I guess, since he just posted the question for the third time... <sigh>
I was thinking someone is making a joke, but (checked headers) it seems to be the same person.
Arno R This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jason |
last post by:
Let's say I have an html form with 20 or 30 fields in it. The form
submits the fields via POST to a php page which updates a table in a
database with the $_POST vars. Which makes more sense?
1) simply UPDATING the values for all fields in the table, whether or
not any particular field has actually changed
2) running a second SELECT statement and comparing the $_POST vars to
the returned values, and only UPDATING those that have...
|
by: It's me |
last post by:
I am new to the Python language.
How do I do something like this:
I know that
a = 3
y = "a"
print eval(y)
|
by: Robin Tucker |
last post by:
Hi there,
I have a database on my test machine that will need to be installed on users
machines. I would like to create the database with the given schema on the
users machine and also with some suitable default values in the tables. I
note that although I can script the schema so that re-creating the structure
of the database is simple on the users machine, I cannot script the contents
of the tables also (automatically). What I would...
|
by: Randell D. |
last post by:
Folks,
I have seven text boxes which will contain measurements - I would like
the user to input their values in the order that I have listed the boxes.
How can I therefore make an input type=text name=box2 a readonly while
type=text name=box1 has a length of zero?
This is for an intranet based application and I understand all the
arguements and points that one has to consider in such that my server
|
by: cwbp17 |
last post by:
Have two tables that have a FK relationship on ID column.
Have one datagrid that displays all of the columns of both tables.
What's the best approach on updating a row from the datagrid back to the
database?
I've used the following code for the DataGird1_UpdateCommand
Option1
| |
by: Colin |
last post by:
I have a query that calculates the selling price of products on
customer orders. Selling prices are calculated based on the average
cost of the items when purchased.
As I make new purchases, the product cost changes (as it should) to
reflect the new average cost. However, the problem is that the selling
price of previously sold items also change when new purchases are
made.
Keep in mind that I'm not storing any calculated values anywhere....
|
by: paolo_maldini |
last post by:
Hello everyone,,,
Here is my problem,
I'm using MS Access, I'm building a mobile inventory system.I have a table (Products) and I want to update the Quantity of mobiles each time I perform a sale operation. Sales operations are performed through a Form(Invoice) and in that form I built a subform-that was built using a query- where most of the sale details are specified. However, I don't know how I can subtract the quantity entered in the...
|
by: Mark Olbert |
last post by:
I've written a composite custom control which I would like to have update its design-time display when one of several properties
changes at design time. These custom properties are not simply the exposed properties of the constituent controls (e.g., they
control how many constitutent controls are displayed).
I am at a loss as to how to go about doing this. I have a custom designer for the control, but I don't see any functionality in the...
|
by: omerbutt |
last post by:
AJAX PROB WITH MULTIPLE RECORDS
helo iam having problem in ma code will any body look out an help, i am trying t add sale record in the database and the checkthe quantity of the part slod and decrement it to the current quantity for example if tehre is a part woth part no 10023 and its quantity in show room is 20 and total quantity is 25 then if there is a sale of 2 parts then i have to add the sale and decrement the current quantity in the...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |