Don't reset the counter

  • Thread starter al416 via AccessMonster.com
  • Start date
A

al416 via AccessMonster.com

I have a form and a subform. The user has to respond to each line on the
subform. After completing all of the lines the user clicks on a button on the
main form to run a bunch of code to complete the process.

I would like to be able to check to make sure that the user has in fact
responded to all of the questions on the subform when the click the complete
button.

I set up an unbounded field in the main form to count all of the responses.
The problem is, sometimes users won't complete all of the responses right
away. Some today and some tomorrow.
How can I set my counter to know the number of non-null response on the
subform.
Once I do this I am assuming I will be able to compare my counter with the
number of questions and prompt the user if they are not equal.
 
J

Jeanette Cunningham

You can check each field on the subform to see if it is null (assuming no
checkboxes).

Instead of counting how many null fields, it is easier to just find if at
least one response is empty.

Here's some idea of how to code this.

Dim blnMissingResponses as Boolean
If Len(Me.[NameOfSubformControl].Form.[ControlName] & vbNullString) <=0 Then
blnMissingResponses = True
End If

If blnMissingResponses = True Then
'cancel the code that processes the responses on the main form
Else
'code here to process the responses
End If

You can write an If -- End If statement for each response you want to check.
If you wish, you can code it differently by setting the tag property to
check, for each control that needs to be checked.
Then use a loop to check for null in any control with its tag property set
to check.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top