So.... I have an UpdateButton Macro assigned to my P.O. Generator, and want it to stop and ensure all fields are filled out prior to update. - Sub UpdateButton()
-
Application.ScreenUpdating = False
-
Dim copySheet As Worksheet
-
Dim pasteSheet As Worksheet
-
-
Set copySheet = Worksheets("Purchase Order")
-
Set pasteSheet = Worksheets("PO Log")
-
-
copySheet.Range("POnumber").Copy
-
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("OrderSummary").Copy
-
pasteSheet.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("POdate").Copy
-
pasteSheet.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("RequestedBy").Copy
-
pasteSheet.Cells(Rows.Count, 4).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("Vendor").Copy
-
pasteSheet.Cells(Rows.Count, 5).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("DeliveryDate").Copy
-
pasteSheet.Cells(Rows.Count, 6).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("Cost").Copy
-
pasteSheet.Cells(Rows.Count, 7).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
Range("='Purchase Order'!$B$2:$N$47").PrintOut
-
-
End Sub
-
2 1497
Okay... So I think I have figured part of it out with - If Cells(4, 3).Value = "" Then
-
MsgBox "Requested By Requires User Input"
-
-
Cancel = True
-
End If
But I would like this add-on to stop the updating process as well... HELP!!
Here's entire code with new MsgBox code. - Sub UpdateButton()
-
Application.ScreenUpdating = False
-
Dim copySheet As Worksheet
-
Dim pasteSheet As Worksheet
-
-
Set copySheet = Worksheets("Purchase Order")
-
Set pasteSheet = Worksheets("PO Log")
-
-
copySheet.Range("POnumber").Copy
-
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("OrderSummary").Copy
-
pasteSheet.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("POdate").Copy
-
pasteSheet.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("RequestedBy").Copy
-
pasteSheet.Cells(Rows.Count, 4).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("Vendor").Copy
-
pasteSheet.Cells(Rows.Count, 5).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("DeliveryDate").Copy
-
pasteSheet.Cells(Rows.Count, 6).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("Cost").Copy
-
pasteSheet.Cells(Rows.Count, 7).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = Tru
-
-
If Cells(4, 3).Value = "" Then
-
MsgBox "Requested By Requires User Input"
-
-
Cancel = True
-
End If
-
-
Range("='Purchase Order'!$B$2:$N$47").PrintOut
-
-
End Sub
For all that are interested.... The solution to my issue was -
-
If IsEmpty(Range("OrderSummary")) Or IsEmpty(Range("RequestedBy")) Or IsEmpty(Range("POnumber")) Then
-
MsgBox "Information is Missing:Requested By, Order Summary, and P.O. Require User Input", vbRetryCancel
-
Exit Sub
-
End If
That is all...
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: David Colliver |
last post by:
Hi all,
I am having a slight problem that hopefully, someone can help me fix.
I have a form on a page. Many items on the form have validation controls
attached.
Also on this form are linkbuttons which must not cause validation. I have
found a setting "causeValidation" to disable the validation.
Also on the page, I have a datagrid that I will edit lines on. I can click
|
by: J055 |
last post by:
Hi
I have 2 update buttons in my FormView ('Apply' and 'OK'). I want both
buttons to update the data source but the 'OK' button should redirect
afterwards.
I can see which button is clicked in the ItemCommand event but I can't
redirect from here because the ItemUpdated event hasn't fired yet.
I can put a variable in the code-behind class which is gets the
|
by: ayneekeaw |
last post by:
When I click the update button/link at the Gridview to update the data from drop down list into the SQL. The selected value of drop down list change to default value. How can I fix this problem
|
by: mesut |
last post by:
Hi there,
I've a question. I would like to create a global update button to
update all changed records gridview.
e.g. A gridview contains 5 columns an 2 of the columns can be updated
by the user. (other 3 are readonly)
e.g. a column called Status is a dropdownlistbox the user can choose a
status of the product and the other column called instructions is a
text box, the user can type in any value.
|
by: schuiazza |
last post by:
Hi,
I am updating a webpage which displays information about electrical networks.
The company requires to update gridstation information regarding voltage based on each are i..e south east etc, office i.e. different states in the country and each office i.e. local area.
I have written button to add new gridstation but while for update button
I am not get to get window popup for all offices, I am able to get popup only for penultimate...
| |
by: geeteshss |
last post by:
Dear all,
actually i spent a whole month on the R&D of datagrid edit ,update,cancel events but recently my guide told me to make it user friendly because no user would like to go on searching rows and columns in a datagrid if there are number of rows and columns.so in my web page i have got two labels two textboxes and three buttons namely add update and delete so when i click on the add button the data is added to datagrid and also displayed...
|
by: stimul8d |
last post by:
Before i get flamed, this isn't the usual question you see left right and center.
I'm dynamically creating usercontrols inside the page_init event and setting the ID's of each control so that the events survive postback. in the user control i have a datagrid which uses the old databinding events (updating, editing etc,...). Here's the problem, the editing event fires but the updating event doen't. Take a look -
This is the...
|
by: shekharncst |
last post by:
Hi I am using GridView in ASPX page
<asp:GridView AutoGenerateEditButton ="false" id="siGridView" runat="server"
Font-Names="Cordia New" Font-Size="Smaller"
AllowSorting="True" AllowPaging ="true" PageSize="20"
HorizontalAlign="left"
onsorting="switchGridView_Sorting"
...
|
by: Cad33ee |
last post by:
Good Day!
I Am using Microsoft Access 2016. I would like to know how can i create a simple update button. I already created add, clear and close. However, I do have a hard time on creating an update button which updates my table. I do also would like to know how to give conditions on text box which you can only input Numbers.
Thanks in advance.
|
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: 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: 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: 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: 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
|
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...
| |