Reading Form ComboBox Values in Button

MattH1

Board Regular
Joined
Jul 15, 2016
Messages
174
Hi everyone,

So I have a form that has three combo boxes, namely "cboLOB" "cboDescription" and "cboStatus". The form's name is "Form", if that's of importance here. The three combo boxes are in descending order and based on the value from one, the appropriate range of values appear in the next box.

I'm all but finished with this form but need to add one last final step that I can't figure out (the most important one funny enough). I want to put a button that runs a VBA code (or macro) to read the values from the 3 combo boxes and reads the main data table to get the 4th value in a message box. How do I go about creating this?

To clarify how this would work, I have a list of all possible combinations in a table called "AllData". Whatever they enter in cboLOB is in Column A, cboDescription in Column B, and cboStatus in Column C. These three values would allow me to target a unique row and output the value in Column D in a message box (which is just YES or NO.)

Any help is very much so appreciated!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
The form's name is "Form", if that's of importance here.
Could prove to be problematic. Form is a reserved word and should not be used to name db objects. As with most issues, there's more than one way to skin this cat. For me, it comes down to how the value you seek is going to be retrieved - query or DLookup. The lookup would probably be trickier to concatenate 3 pieces of criteria, the query would require getting the value into a message box via vba. If you need help with a lookup, you'll have to provide the real names of the table fields involved (which I think you are referring to as columns) and their data types. If it's a query, the sql that includes the value to be presented in the message should suffice.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,771
Messages
6,161,847
Members
451,723
Latest member
Rachetsely

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top