listing fieldnames in a MSGBOX

  • Thread starter Thread starter Mark R
  • Start date Start date
M

Mark R

I am trying to construct a message for a
MsgBox in the BeforeUpdate event, listing the fields on
the current form that are still NULL.

How do I get the fields to become listed in the msgbox?

AIR CODE I can envision:
===========================
for each fieldOfNoSequentialNameConvention
IF ISNULL(field1) then
include it on the msgbox

next fieldOfNoSequentialNameConvention

print msgbox
 
Build a string variable by concatenating the names of the combo boxes into
the string, and then use the string as the message. Something like this:

Dim strMsg As String
Dim ctl As Control
strMsg = ""
For Each ctl In Me.Controls
' This code line assumes that you want to check just
' textboxes. If others, then expand with other intrinsic
' variables in a "OR" list.
If ctl.Type = acTextBox Then
If IsNull(ctl.Value) = True Then _
strMsg = strMsg & ctl.Name & vbCrLf
End If
Next ctl
If strMsg <> "" Then
strMsg = "You must select a value for the following controls:" & _
vbCrLf & strMsg
MsgBox strMsg
End If
 
Back
Top