Check for empty/null fields in subform datasheet recordset

ccondran08

Registered User.
Local time
Tomorrow, 03:16
Joined
Feb 27, 2014
Messages
58
I have just watched this youtube video clip https://www.youtube.com/watch?v=fe5D4iK0Pvk& in the search for the answer for my problem. This video clip shows you how to loop through all the controls (text boxes) on a form and find the blank control fields and highlight them red and alert with a message box.

For Each ctrl In Me.Controls
If ctrl.Tag = "FILL" Then
If IsNull (ctrl) Or Len (ctrl) = 0 Then
ctrl.BackColour = vbRed
CheckForEmpty = False
End If
Next

However, what I am looking for is a solution that will loop through a certain field in a subform datasheet recordset (query) and highlight in red where there is a blank field and also prompt a message box to alert the user that there are blank fields. I appreciate any help.
 
you can use conditional formatting.
 
Thanks arnelgp, that was second choice.
 
I tried the same thing but when you are using a tabular sub form it does not work because it includes previous records that are listed in the sub form for one client ID. I really do not know if it can be done any other way ??
 
Hi rcerda

Firstly welcome to the forum. Perhaps you could do an introductory post about yourself as well

Anyway as you probably realised, this is an old thread.
I've not tried it in a tabbed subform if that's what you meant (or with a datasheet) but attached is a screenshot of how I do this in a single form layout.

attachment.php


In this example there are two required fields that haven't been completed.
These are highlighted in a deliberately 'loud' colour to make them stand out & a message box explains the issue to users.
I'm not using conditional formatting to do any of this

If its any use, I can post the code tomorrow
 

Attachments

  • Capture.PNG
    Capture.PNG
    30.8 KB · Views: 1,245
Last edited:

Users who are viewing this thread

Back
Top Bottom