M
mark r
Looking for a "neater coding" method using a Do Loop
to substitute and clean up code that already works.
The user clicks a command button to hide the subform. The
underlying code verifies if the user has still entered
data into several fields, reminding the user that
eventually, these fields need to have data before further
processes can commence.
Using a series of nested IF..then..else
If isnull(field1) then
msgbox
else
if isnull(field2) then
msgbox
else
etc
Is it possible somehow have a variablename concatenated
with a changing counter and define each resulting variable
with an actual field name
Dim fldnamevariable, counter, fldname(counter)
fldname1 = field1
fldname2 = field2
fldname3 = field3
fldname4 = field4
..
..
..
fldname10 = field10
Do
if isnull(
fldname(counter)
)
then
MSGBOX
counter = counter + 1
while counter <11
end sub
to substitute and clean up code that already works.
The user clicks a command button to hide the subform. The
underlying code verifies if the user has still entered
data into several fields, reminding the user that
eventually, these fields need to have data before further
processes can commence.
Using a series of nested IF..then..else
If isnull(field1) then
msgbox
else
if isnull(field2) then
msgbox
else
etc
Is it possible somehow have a variablename concatenated
with a changing counter and define each resulting variable
with an actual field name
Dim fldnamevariable, counter, fldname(counter)
fldname1 = field1
fldname2 = field2
fldname3 = field3
fldname4 = field4
..
..
..
fldname10 = field10
Do
if isnull(
fldname(counter)
)
then
MSGBOX
counter = counter + 1
while counter <11
end sub