Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 153
  • Last Modified:

Proper way of using this password

What is the shortest way to make  this code functional?
Private sub Command1_Click()
if text1. text or text2.text or text3.text or text4.text = "" then
msgbox "Good"
else
Msgbox "Okey"
exit sub
end if

Open in new window

0
Whing Dela Cruz
Asked:
Whing Dela Cruz
  • 2
  • 2
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
you cannot compare the same value against multiple controls like this.

you have to do this:

Private sub Command1_Click()
if text1.text = "" or text2.text = "" or text3.text = "" or text4.text = "" then
msgbox "Good"
else
Msgbox "Okey"
exit sub
end if

Open in new window

0
 
Whing Dela CruzAuthor Commented:
Thanks emoreau it works..
in this procedure, Can i make a msgbox that will specify or tells which of the textbox is blank?
example a message says like this
text2.text is blank
thanks...
0
 
Éric MoreauSenior .Net ConsultantCommented:
You will need to compare one by one:
Private sub Command1_Click()
if text1.text = "" then
msgbox "Good - text1 is empty"
elseif text2.text = "" then
msgbox "Good - text2 is empty"
elseif text3.text = "" then
msgbox "Good - text3 is empty"
elseif text4.text = "" then
msgbox "Good - text4 is empty"
else
Msgbox "Okey"
exit sub
end if

Open in new window

0
 
Whing Dela CruzAuthor Commented:
Thanks emoreau, it works ...
More Power to you....
Please see my other post questions...
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now