Form data entry

  • Thread starter shangman via AccessMonster.com
  • Start date
S

shangman via AccessMonster.com

I have a form where personnel enter scores for an audit. There are 5 sections
to the audit. As they score each question in the section it gives a total
overall average for each section. For example section 1 has 6 questions
labeled wk1, wk2, wk3, wk4, wk5 wk6. (each are a text box) They would enter
a score of 0 - 5. Each section scores this way. Some sections have more or
less entries. Also after then audit is complete i have it calculate an
overall ave from all 5 sections. This is all working fine.
What i would like to happen is, if section 1 overall ave of < 4, then when
they score answers in (lets say) section 5, the scores for each question
cannot be > 4, or if section 1 overall ave is < 3, the score entry for
section 5 questions cannot be > 3, and so on. I dont know where or really how
to write the code for this. Would this be an "if" statement for each textbox
say in section 5. here is an example of what i use for the first section:

Public Sub findave()
totval = 0
wkcount = 0
Dim flist As Variant
flist = Array(Me.wk1, Me.wk2, Me.wk3, Me.wk4, Me.wk5, Me.wk6)


For Each x In flist
If x.Value > -1 Then
totval = totval + x.Value
wkcount = wkcount + 1
End If
Next x
If wkcount > -1 Then
tempval = totval / wkcount
overall.Value = totval / wkcount
End If

End Sub
This in put in "after update" for textbox wk1
Private Sub wk1_AfterUpdate()
Call findave
End Sub
 

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