• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • Last Modified:

how to check a form input before saving?

I'm new in VB. I want to write a program  that ask the user to fill out some text box of Personal Information.  
How to make sure all fields in the form are fill out by User before saving the form?
1 Solution
How are you going know when to save the form? Are you going to have the user press a button? With a little more detail, I can give you what you need.
One method is to set a flag varaible and run thru the items looking for blanks.

Assume you have a control array of text boxes

flag = True    'Assume all are filled
FOR ndx = 1 TO Text1.UBound
 IF len( Text1(ndx).Text ) < 1 THEN flag = False
NEXT ndx

When you get out of the loop FLAG will be False if any item is blank.

BergJC is right, this code should be in the CLICK event of your [Submit] button.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

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