Access - VBA on a form

SantasLittleHelper

Board Regular
Joined
Nov 25, 2016
Messages
77
Could anyone help me with the VBA writing for the below:

It is basically lots of 'IF' validations

IF 'Fleid1', 'Fleid2', 'Fleid3', 'Fleid4', 'Fleid5' in 'Form1' are blank then display error message that says 'Please complete the missing fields'

This might be a simple thing to do but I'm not good with VBA
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Is this a bound Form?
Are the fields attached to table fields?
If so, the easiest thing to do is to make the field required at the Table level, then it will require them to be filled out on the Form level as well.
Otherwise, you will need to do something like this: Required Fields - Microsoft: Access Forms - Tek-Tips
 
Upvote 0
After reviewing the link, consider an embellishment:
If the task of determining when a control has no data is something you might want to use repeatedly, then give the task to a function which returns True (it has no data) or False (it is not empty). Also, it's not too difficult to gather all the control names in this validation process and present them all at once in a message box rather than one at a time. If the label for a control is attached to the control, the label text can be presented in the message. Words like Customer Name are often more meaningful to the user than txtCustName. This approach would require each required control have a value in its .Tag property (such as "Reqd"), and the code only looks at the type of control you want (textbox, combo box or both).
 
Upvote 0

Forum statistics

Threads
1,214,793
Messages
6,121,619
Members
449,039
Latest member
Mbone Mathonsi

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