Help with "Select Case"

Mebs

Board Regular
Joined
Mar 16, 2009
Messages
51
Need some help with 'Select Case'.

I have the following; on a form
Comb_buyer
Comb_comp
Comb_job
txtBx_Projtitle
txtBx_BU
TxtBx_PurOrdNo
TxtBx_PurOrdDate

What I need to do is, on click of Cmdbtt_Draft button, I need to check if any of the above is blank (empty, null, etc) then display message box listing which ones are blank (empty, null, etc). If none are blank (empty, null, etc) then message box with "Written to Database, with Status of Draft". Any suggestions?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
You dont use select case - but something like this - I assume these are textboxes and ComBoBoxes.


If isempty(txtbx_Projtitle) then MsgBox"Enter data": exit sub

If Comb_job.listindex<0 then MsgBox"Select data":exit sub



Need some help with 'Select Case'.

Comb_job
txtBx_Projtitle

then message box with "Written to Database, with Status of Draft". Any suggestions?
 
Upvote 0
Rasm, thanks for the quick response. The combo boxes work fine but the text boxes don't? But if they are blank or empty then no message appears?
 
Upvote 0
try this - trim removes spaces on both ends

If trim(txtbx_Projtitle.text) = vbnullstring then MsgBox"Enter data": exit sub
 
Upvote 0
BTW - it is a bad idea to use _ in your names - that is how an event is normally triggered - I dont know if it is an actual problem - But I suggest you dont use underscores.
 
Upvote 0
Thanks, it works. I'll bear the underscore in mind next time.

Is there a way that I get one message box that appears listing all the ones that are blank?
 
Upvote 0

Forum statistics

Threads
1,224,524
Messages
6,179,310
Members
452,906
Latest member
phanmemchatdakenhupviral

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