473,394 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Submit button will only work for half the options in a combo box

Expand|Select|Wrap|Line Numbers
  1. Private Sub Submit_Button_Click()
  2. If IsNull(Me.Type_Text) Or Me.Type_Text = "" Then
  3.     MsgBox "Please select criteria for Report Type.", vbExclamation, "Attention"
  4. Else
  5.     If Me.Type_Text = "Requisitions" Then
  6.         DoCmd.OpenForm "Date Form"
  7.     Else
  8.         If [Forms]![Report Form]![Equipment Combo] = "" Then
  9.             DoCmd.OpenReport "Equipment Inventory Report", acViewPreview
  10.         End If
  11.     End If
  12. End If
  13. End Sub
  14.  
Aug 13 '15 #1
4 1209
so in the combo box I have the options "requisitions" and "inventory". the submit button works for the requisitions option and opens the date form, but it does not perform the action and go to the "equipment inventory report" when i click on "inventory
Aug 13 '15 #2
jforbes
1,107 Expert 1GB
Is [Equipment Combo] blank?

You might want to put something like the following to see if it is falling through your code without doing anything:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Submit_Button_Click()
  2.  If IsNull(Me.Type_Text) Or Me.Type_Text = "" Then
  3.      MsgBox "Please select criteria for Report Type.", vbExclamation, "Attention"
  4.  Else
  5.      If Me.Type_Text = "Requisitions" Then
  6.          DoCmd.OpenForm "Date Form"
  7.      Else
  8.          If [Forms]![Report Form]![Equipment Combo] = "" Then
  9.              DoCmd.OpenReport "Equipment Inventory Report", acViewPreview
  10.          Else
  11.              MsgBox "Please fill provide the Equipment Something.", vbExclamation, "Attention"
  12.          End If
  13.      End If
  14.  End If
  15.  End Sub
  16.  
Aug 13 '15 #3
I added that code and when I clicked the "submit button, that msgBox did pop up. How do I fix it so that it will link the equipment in the box. I am selecting a piece of equipment in the previous form and its working for the "requisitions" option of the combo box, but not the 'inventory"
Aug 17 '15 #4
jforbes
1,107 Expert 1GB
I'm not really sure what you are attempting to do, so this is my best guess. My guess is that the test for an [Equipment Combo] selection is backwards, so I would swap the sign (or swap the code).

Swapping Sign:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Submit_Button_Click()
  2.   If IsNull(Me.Type_Text) Or Me.Type_Text = "" Then
  3.       MsgBox "Please select criteria for Report Type.", vbExclamation, "Attention"
  4.   Else
  5.       If Me.Type_Text = "Requisitions" Then
  6.           DoCmd.OpenForm "Date Form"
  7.       Else
  8.           If Nz([Forms]![Report Form]![Equipment Combo], "") <> "" Then
  9.               DoCmd.OpenReport "Equipment Inventory Report", acViewPreview
  10.           Else
  11.               MsgBox "Please fill provide the Equipment Something.", vbExclamation, "Attention"
  12.           End If
  13.       End If
  14.   End If
  15.   End Sub
Or, Swapping Code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Submit_Button_Click()
  2.   If IsNull(Me.Type_Text) Or Me.Type_Text = "" Then
  3.       MsgBox "Please select criteria for Report Type.", vbExclamation, "Attention"
  4.   Else
  5.       If Me.Type_Text = "Requisitions" Then
  6.           DoCmd.OpenForm "Date Form"
  7.       Else
  8.           If [Forms]![Report Form]![Equipment Combo] = "" Then
  9.               MsgBox "Please fill provide the Equipment Something.", vbExclamation, "Attention"
  10.           Else
  11.               DoCmd.OpenReport "Equipment Inventory Report", acViewPreview
  12.           End If
  13.       End If
  14.   End If
  15.   End Sub
Aug 17 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Ryan | last post by:
I currently have two image submit buttons. The code generated looks like so: <input type="image" src="button_in_cart.gif" border="0" alt="Add" title="Add" name="btn_cart" value="buy"> <input...
3
by: Matt | last post by:
The ASP page has a combo box with id list, and when user click the particular id, it will show the name in the text box. My attempt was when the user have event on combo box, it will call...
3
by: Matt | last post by:
I want to understand the difference between submit button and regular button: <input type="submit"> and <input type="button">. My understanding is that submit button will send the entire HTML form...
2
by: a10392 | last post by:
Hi, I'am triyng to create a form where i have 2 comboBox and 2 textbox, when the selection changes on the first combo , the content of second also changes. i have to use onchange=form.submit() ...
2
by: bbcrock | last post by:
I created a "cancel" button for my form at the clients' request, I accidentally copied a submit button and added an OnClick event- a very simple javascript.history function. It did not appear to...
4
by: Dmitry Korolyov [MVP] | last post by:
When we use btnSubmit.Attributes = "javascript: this.disabled=true;" to make the button disabled and prevent users from clicking it again while form data still posting, there is no longer...
5
by: Alex | last post by:
Hello, I hope I can explain this properly. I'm writing an application with a tabbed-based navigation, and a form which gets filled out by users will be split into 5 subtabs. What I need is...
1
by: sschmidt460 | last post by:
Private Sub Submit_Button_Click() If IsNull(Me.Type_Text) Or Me.Type_Text = "" Then MsgBox "Please select criteria for Report Type.", vbExclamation, "Attention" Else If Me.Type_Text =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.