Forum Discussion

Michael1105's avatar
Michael1105
Brass Contributor
Mar 13, 2020

How do I make a field mandatory for input?

I am having an issue with trying to have a field require mandatory input.  Within a Form that I have established via the Customize Ribbon--> Developer--> Forms option which is assigned to the Table created to house the inputted data, I need for a field to require mandatory input.  The Form will ask for a Date, number of Accounts, and number of Forms. Within the Forms field (columns/rows F8:F17) I need for the user to be required to input a value of Zero (0) and above.  This field cannot be left blank. Also, within this field (columns/rows F8:F17) I have assigned Data Validation that requires the number in this field to not exceed the number in the Accounts field (columns/rows E8:E17).  Any search online for a VBA code has proven unhelpful. The one I found and tried inputting keeps returning a Compile error: Expected: end of statement response.  Since I am not skilled at all on VBA I am at a standstill. I have attached a screen shot for reference. Can someone please assist?  I would greatly appreciate it.

1 Reply

  • Charla74's avatar
    Charla74
    Iron Contributor
    You will need to input the exception in the vba code. For example if the dimension for the 'forms' entry is declared as 'forms' then you would need to add a line of code something like

    If forms.value = "" Then
    Msgbox "You must enter a value in the Forms field."
    End if

Resources