hi all
first i would like to thank PC Datasheet, i got so far because of
him/her
i need some help again
i have this command button[listing update]
the on-click event procedure is
Private Sub listing_update_ Click()
On Error GoTo ErrorHandler
DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenQuery "query listing Update", acNormal, acEdit
DoCmd.OpenQuery " query append arc", acNormal, acEdit
Me![list 0u] = 0
Me![list 1n] = 0
Me![list 2r] = 0
Me![list 3m] = 0
Me![list 4m] = 0
Me![list 5d] = 0
ExitHere:
Exit Sub
ErrorHandler:
MsgBox Err.description
Resume ExitHere
End Sub
i would like it to do one more thing
after it enters the 0s in, i need it to
add up the vaues of 6 textboxes [0 untested re], [1 new re], [2
repaired re] . . . . . etc. and if the value is 0 i need to delete the
current record, if it is not 0 just go back to the form.
i tried if -then . . just cant get the sintax (cant even spell it)
right 2 2245
Dim intSum As Integer 'change the type if needed Me![list 5d] = 0
'The Nz's are to change Null values to zero. If not used and any one of the
values
'is Null, then the answer will be Null.
intSum = Nz(Me.[0 untested re],0) + Nz(Me.[1 new re], 0) + Nz(Me.[2 repaired
re],0) + etc
If intSum = 0 Then
'This will delete the current record on the form.
RunCommand acCmdDeleteReco rd
End If ExitHere:
--
Wayne Morgan
MS Access MVP
"gbb0330" <gb*****@gmail. com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . hi all
first i would like to thank PC Datasheet, i got so far because of him/her
i need some help again
i have this command button[listing update]
the on-click event procedure is
Private Sub listing_update_ Click() On Error GoTo ErrorHandler DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 DoCmd.OpenQuery "query listing Update", acNormal, acEdit DoCmd.OpenQuery " query append arc", acNormal, acEdit Me![list 0u] = 0 Me![list 1n] = 0 Me![list 2r] = 0 Me![list 3m] = 0 Me![list 4m] = 0 Me![list 5d] = 0
ExitHere: Exit Sub
ErrorHandler: MsgBox Err.description Resume ExitHere
End Sub
i would like it to do one more thing after it enters the 0s in, i need it to add up the vaues of 6 textboxes [0 untested re], [1 new re], [2 repaired re] . . . . . etc. and if the value is 0 i need to delete the current record, if it is not 0 just go back to the form.
i tried if -then . . just cant get the sintax (cant even spell it) right
The only thing that I would guess at would be if the query still had the
record(s) locked at the time the code was running. Instead of the
DoCmd.RunQuery, try
CurrentDb.Execu te "query listing Update", dbFailOnError
With the error switch on the end, if the query doesn't work properly, you'll
get an error back. I don't know, but I'm hoping, that this means the code
will have to wait and see if the query finished properly. If that doesn't
work, there is a command that can be used to "flush the buffer" to force all
the queued disk writes to finish and release the record locks.
DBEngine.Idle dbRefreshCache
--
Wayne Morgan
MS Access MVP
"gbb0330" <gb*****@gmail. com> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.com... thanks Wayne, it works
now i have another problem, the values in[list 0u],[list 1n] etc. will not reset to 0 every time, sometimes they will and sometimes they wont - so far i havent been able to find a patern.
what i am trying to accomplish is to get the number of itmes on hand from [main table]. the items are clasified in categories from [0 untested re] to [5 dead re]
the user will type in the number of items that were listed for sale on e-bay from[list 0u] to[list 5d]
then i am using an update query to subtract the number of items listed from the number of items on hand. the query is called [query listing update] for example the query updates the field [0 untested re] to [Main Table]![0 untested re]-[Main Table]![list 0u]
then i use an append query to keep a record of what has been listed
after that i set the values in[list 0u],[list 1n] etc. to 0 the reason i do that is beacuse - lets say we hav 5 items on hand but we only want to list 3, the user wants to be able to list some or all of the items in one listing so they have to type in the number every time.
and then if there are no more items left on hand the record is deleated.
any help will be very appreciated
here is the code:
Private Sub listing_update_ Click() On Error GoTo ErrorHandler DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenQuery "query listing Update", acNormal, acEdit
DoCmd.OpenQuery " query append arc", acNormal, acEdit
Me![list 0u] = 0 Me![list 1n] = 0 Me![list 2r] = 0 Me![list 3m] = 0 Me![list 4m] = 0 Me![list 5d] = 0 Me![e-bay number] = Null
Dim intSum As Integer
intSum = Nz(Me.[0 untested re], 0) + Nz(Me.[1 new re], 0) + Nz(Me.[2 repaired re], 0) + Nz(Me.[3 minor defect re], 0) + Nz(Me.[4 major defect re], 0) + Nz(Me.[5 dead re], 0) If intSum = 0 Then 'This will delete the current record on the form.
DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.DoMenuIte m acFormBar, acEditMenu, 6, , acMenuVer70
End If
ExitHere: Exit Sub
ErrorHandler: MsgBox Err.description Resume ExitHere
End Sub
Wayne Morgan wrote: Dim intSum As Integer 'change the type if needed
> Me![list 5d] = 0 > 'The Nz's are to change Null values to zero. If not used and any one of the values 'is Null, then the answer will be Null. intSum = Nz(Me.[0 untested re],0) + Nz(Me.[1 new re], 0) + Nz(Me.[2 repaired re],0) + etc If intSum = 0 Then 'This will delete the current record on the form. RunCommand acCmdDeleteReco rd End If > > ExitHere:
-- Wayne Morgan MS Access MVP
"gbb0330" <gb*****@gmail. com> wrote in message news:11******** **************@ f14g2000cwb.goo glegroups.com.. . > hi all > > first i would like to thank PC Datasheet, i got so far because of > him/her > > i need some help again > > i have this command button[listing update] > > the on-click event procedure is > > Private Sub listing_update_ Click() > On Error GoTo ErrorHandler > DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 > DoCmd.OpenQuery "query listing Update", acNormal, acEdit > DoCmd.OpenQuery " query append arc", acNormal, acEdit > Me![list 0u] = 0 > Me![list 1n] = 0 > Me![list 2r] = 0 > Me![list 3m] = 0 > Me![list 4m] = 0 > Me![list 5d] = 0 > > > ExitHere: > Exit Sub > > ErrorHandler: > MsgBox Err.description > Resume ExitHere > > End Sub > > > i would like it to do one more thing > after it enters the 0s in, i need it to > add up the vaues of 6 textboxes [0 untested re], [1 new re], [2 > repaired re] . . . . . etc. and if the value is 0 i need to delete the > current record, if it is not 0 just go back to the form. > > i tried if -then . . just cant get the sintax (cant even spell it) > right > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mksql |
last post by:
New to Tkinter. Initially, I had some code that was executing button commands at
creation, rather than waiting for user action. Some research here gave me a
solution, but I am not sure why the extra step is necessary.
This causes the "graph" function to execute when the button is created:
Button(root, text='OK', command=graph(canvas)))
However, this waits until the button is pressed (the desired behavior):
def doit():
graph(canvas)
|
by: Paul A. Wilson |
last post by:
I'm new to Tkinter programming and am having trouble creating a
reusable button bar... I want to be able to feed my class a dictionary
of button names and function names, which the class will make.
My button bar is implemented a Frame subclass, which takes the button
dictionary as an argument and displays the buttons on the screen:
class OptionsBar(Frame):
def __init__(self, buttonDict, parent=None)
Frame.__init__(self, parent)
|
by: dakman |
last post by:
Recently, I have been needing to do this alot and I can never find a
way around it, the main reason I want to do this is because for example
in the application I am making right now, it creates a grid of buttons
in a loop and they all have the same purpose so they need to call the
same method, within this method they need to change the background
color of the button clicked, I've tried stuff like...
button = lambda: self.fill(button)
...
|
by: Chris Bolus |
last post by:
I'm a teacher using MS Access on an RMConnect 2.4 network. On some
workstations both I and my students sometimes get an error message
when attempting to insert a command button on a form which reads
"Invalid
use of null". The remainder of the options in the Command Button
Wizard are then unavailable and
the button wil not work.
The only solution is to log on to a different workstation.
Any ideas?
|
by: Melissa |
last post by:
What is the code to delete a command button from a form? Can the code be run
from the click event of the button to be deleted?
Thanks!
Melissa
| |
by: deko |
last post by:
I have a several forms that accept user input in a textbox and then take
some action based on that input after a command button is clicked. Is it
possible issue the command when the user presses Enter rather than clicking
the command button?
I've tried this, but for some reason it's not working:
Private Sub txtFind_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call cmdFind_Click
End Sub
|
by: Kevin |
last post by:
A couple of easy questions here hopefully. I've been working on two
different database projects which make use of multiple
forms.
1. Where's the best/recommended placement for command buttons for things
like delete, save, edit, cancel buttons - in the footer, or on the form
detail section?
2. If in the footer, how do you add them to the tab order?
|
by: Alex Chun |
last post by:
How can I program a command button on a form to bring up the standard "Find
and Replace" dialog on click?
Separate but related: how do you run menu commands (e.g. "Edit" "Find") from
VB?
Thanks in advance!
Alex
|
by: John Smith |
last post by:
I have a continuous form. there is a command button with the following code
for the OnClick event:
DoCmd.OpenForm "frmPlants", , , "PlantsID =" & Me!PlantsID
I click the button and frmPlants opens up with the record that corresponds
to the one on the cont. form.
I put that same code for the OnClick of an image control (i.e. the user
clicks a little icon to open the form instead of a button) and frmPlants
|
by: kimiraikkonen |
last post by:
Hi experts,
I just want to ask a simple procedure of my simple form. My form has a
input textbox and a button.
I want this if you can help me:
Application user types a command prompt command like "dir" into
"textbox", then after clicking "button", command prompt(cmd) should
run with the prompt that user has written already into "textbox" .
|
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: 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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |