Hi Guys
Seen a few posts on this and yet still cant make it work for me
I need in my form which has 10 different combo boxes or txtboxes to be filled out before the will allow you to save it !
Ive been close with this module but all it does when I hit save is shut form down and saves even if there are still blank boxes
To be honest im not 100% sure of what areas to change of this code to suit my db
the required tag do you write required in the properties box of other?
Code tags added by UG
Any help would be very welcome
Dan
Seen a few posts on this and yet still cant make it work for me
I need in my form which has 10 different combo boxes or txtboxes to be filled out before the will allow you to save it !
Ive been close with this module but all it does when I hit save is shut form down and saves even if there are still blank boxes
To be honest im not 100% sure of what areas to change of this code to suit my db
the required tag do you write required in the properties box of other?
Code tags added by UG
Code:
Public Function validateform(myform As Form) As Boolean
'returns true if all required fields have data, or false if not.
'It will also create a popup message explaining which fields need data
Dim boolresponse As Boolean
Dim strError As Variant
Dim ctl As Control
boolresponse = True
strError = Null
With myform
For Each ctl In .Controls
With ctl
If .Tag = "required" Then
If .Value & "" = "" Then
boolresponse = False
strError = (strError + ", ") & .Name
End If
End If
End With
Next ctl
End With
If strError & "" "" Then MsgBox "The following information must be entered first: " & strError, vbInformation
validateform = boolresponse
End Function
Any help would be very welcome
Dan
Last edited by a moderator: