-
WSsvetljop
AskWoody LoungerThank you very much indeed for your reply.If i subtract with 0 quantities, then i receice minus values.How can i avoid that?I want to substract only when the quantity is not 0
Best regards
-
WSsvetljop
AskWoody LoungerDear Sir,
I am afraid you are right.I am mixing up the meaning of Null and Zero.So i am trying to add from a zero or Null value and i cannot do it.In simple words, if i have no product in the warehouse, and add a new quantity, how shall i proceed with my function,and shall i put 0 in the default value of the field?
What i want is to add a new quantity from zero in my stocks of products.
Once again thank you very much .I hope i may solve my problem quite soonBest regards
-
WSsvetljop
AskWoody LoungerYeas you are right, the initial value is Null. Is there any way on Access to avoid that?
Best regards -
WSsvetljop
AskWoody LoungerI beg to be apologized.I am so grateful for your previous replies and you did give me a chnace to solve
some my problems with your wonrdeful advices
May i wish you all the bestBest regards
-
WSsvetljop
AskWoody LoungerDear Charlotte,
I want to thank you to you and all other contributors to this forum for the excellent advice
and wonderful solutions i have received.
The update code suggested by you works wonderful and without errors. I had 4 functions before andnow i will have one!!!
May i ask you for some additional help? I have simplified my code because i wanted to be moreclear and also i thought i could manage it myself.But i cant.
Actually after the update process,which you have solved sucessfully, i have to carry our adeletion process as follows
CurrentDb.Execute “DELETE * FROM [Order Details] WHERE orderid = ” & orderid & “;”
CurrentDb.Execute “DELETE * FROM [Orders] WHERE orderid = ” & orderid & “;”and another function for the paymentid,if i have to delete the payments:
CurrentDb.Execute “DELETE * FROM [Order Details] WHERE paymentid = ” & paymentid & “;”
CurrentDb.Execute “DELETE * FROM [Orders] WHERE paymentid = ” & paymentid & “;”Since it may be the same Where clause i tried to put it inside but i received an
error too few parameters.
If i can manage to do this i will have a miracle code.Can you help?I want to do it all in onefunction.
-
WSsvetljop
AskWoody LoungerCurrentDb.Execute “UPDATE orders INNER JOIN (products INNER JOIN [order details] ON (products.Productid = [order details].ProductID) AND (products.Productid = [order details].ProductID)) ON orders.orderid = [order details].OrderID SET products.stock = products.stock+[order details].cartons WHERE orders.orderid = ” & Screen.ActiveControl & “”
Dear Sir,
Thank you so much for your advice.It works excellent and saves a lot of time!!!!
No that i solved the problem, may i ask you an additionalk question,applying your solution. .I think i can further simplyfy my coding.I have two functions,they are similar ,only the Where clause is dufferent.In the first function, like the above , the diferring part of the where clause is
WHERE orders.orderid
in the other function the differing part of the where clause is :
WHERE orders.paymentidThe full second function is the following
CurrentDb.Execute “UPDATE orders INNER JOIN (products INNER JOIN [order details] ON (products.Productid = [order details].ProductID) AND (products.Productid = [order details].ProductID)) ON orders.orderid = [order details].OrderID SET products.stock = products.stock+[order details].cartons WHERE orders.paymentid = ” & Screen.ActiveControl & “”So you see, the two functions are different only in that part of the where clause.Is it possbile to create a constant and then replace this constant,or something like that?
I am very grateful to you anywayPlease accept my best regards
-
WSsvetljop
AskWoody LoungerThank you very much for your precious advices.I want to express my appreciation of this site since it is niot the first time that i receive very kind and very clever suggestions.
I want to be a bit more clear with ehat I want to do in order to help me find my mistakes.I want to open a report with a function, and on opening the report I want that
some actions to be executed with another function.Obviously the first function should be declared as Boolean like
==============================
Public Function f1(args) As Boolean
DoCmd.OpenReport “R1”, acViewPreview
End Function
===========================
This function is triggered by the onclick event of a control on a form like this
======================
Private Sub Command472_Click()
F1 (args)
End Sub
============================
I want to use another function, which for sake of clarity I have simplified like this
=========================
Public Function beepit()
DoCmd.Beep
End Function
==========================
And I want this function to be used in the OnOpen event of a report only when the function f1(args)is used, like this:
=============================
Private Sub Report_Open(Cancel As Integer)
If Fc1(args) = True Then
Beepit
End If
End Sub
==========================
A very elegant solution but I doesn -
WSsvetljop
AskWoody LoungerThank you for your attention. I have simplified the task.Actually i have several invisible controls on the report and they are made visible depending on the chosen mode of action, for example one control is called InvoiceNumebr and the other OrderNumber.So in case of an invoice the control InvoiceNumnber is made visible.The funny thing is that if i only wnat to open the report without printing it, i can see the control on the screen, but if add on the command to print, then the control is not seen on the screen even though that it is printed.
Best regards
Slav -
WSsvetljop
AskWoody Loungertgahnk you for the reply.I am afraid i shoudlk,s end the whole database,however i coukd zip it and it will niot be greater than 700KB. If you woukd agree to have a look pleae let me knwo w your email address.
Once again thank you very much
Best regards -
WSsvetljop
AskWoody LoungerDear Sir,
Thank you very much for your reply.What i want is by entering the order number do go directly to that order number in the list box.This is very important to
me and i will be really grateful if you can help me.Is it possible that i send to you the zipped database?
It will be only 100 KB.By looking in the real form you might give me some precious recommendations.If you would agree will you let me know the adress where to sendBest regards
P.S, becasue of some other reasons i will ned a lsit box and not a
combo box or a subform. -
WSsvetljop
AskWoody LoungerDear Sir,
Thank you very much for your answer. I think you have given me the right answer, but somehow my code doesnt work, obvisouly my mistake is somehwere else.What i receive now is the message Too Few Parameters.Expected:2
Will you agree to send to you my real example ina databsze, compressed with a zip file so
to save space? i will be very grateful of you would help me because this problem is of very
important to meBest regards
Slav
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Thunderbird release notes for 128 esr have disappeared
by
EricB
1 hour, 45 minutes ago -
CISA mutes own website, shifts routine cyber alerts to X, RSS, email
by
Nibbled To Death By Ducks
4 hours, 55 minutes ago -
Apple releases 18.5
by
Susan Bradley
5 hours, 14 minutes ago -
Fedora Linux 40 will go end of life for updates and support on 2025-05-13.
by
Alex5723
6 hours, 21 minutes ago -
How a new type of AI is helping police skirt facial recognition bans
by
Alex5723
6 hours, 59 minutes ago -
Windows 7 ISO /Windows 10 ISO
by
ECWS
13 hours, 55 minutes ago -
No HP software folders
by
fpefpe
14 hours, 40 minutes ago -
Which antivirus apps and VPNs are the most secure in 2025?
by
B. Livingston
6 hours, 52 minutes ago -
Stay connected anywhere
by
Peter Deegan
20 hours, 2 minutes ago -
Copilot, under the table
by
Will Fastie
11 hours, 16 minutes ago -
The Windows experience
by
Will Fastie
1 day, 2 hours ago -
A tale of two operating systems
by
Susan Bradley
17 hours, 13 minutes ago -
Microsoft : Resolving Blue Screen errors in Windows
by
Alex5723
1 day, 7 hours ago -
Where’s the cache today?
by
Up2you2
1 day, 22 hours ago -
Ascension says recent data breach affects over 430,000 patients
by
Nibbled To Death By Ducks
1 day, 15 hours ago -
Nintendo Switch 2 has a remote killing switch
by
Alex5723
16 hours, 2 minutes ago -
Blocking Search (on task bar) from going to web
by
HenryW
1 day, 23 hours ago -
Windows 10: Microsoft 365 Apps will be supported up to Oct. 10 2028
by
Alex5723
2 days, 16 hours ago -
Add or Remove “Ask Copilot” Context Menu in Windows 11 and 10
by
Alex5723
2 days, 16 hours ago -
regarding april update and may update
by
heybengbeng
2 days, 17 hours ago -
MS Passkey
by
pmruzicka
1 day, 19 hours ago -
Can’t make Opera my default browser
by
bmeacham
3 days, 1 hour ago -
*Some settings are managed by your organization
by
rlowe44
2 days, 12 hours ago -
Formatting of “Forward”ed e-mails
by
Scott Mills
3 days ago -
SmartSwitch PC Updates will only be supported through the MS Store Going Forward
by
PL1
3 days, 20 hours ago -
CISA warns of hackers targeting critical oil infrastructure
by
Nibbled To Death By Ducks
4 days, 5 hours ago -
AI slop
by
Susan Bradley
1 day, 22 hours ago -
Chrome : Using AI with Enhanced Protection mode
by
Alex5723
4 days, 6 hours ago -
Two blank icons
by
CR2
1 day, 14 hours ago -
Documents, Pictures, Desktop on OneDrive in Windows 11
by
ThePhoenix
1 day, 16 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.