G
Guest
I have this code and I need to convert this to a query. The reason it is a
new field and the current records being entered will do this but I also need
to update the old records also. So can anyone help guide me in making a
Update query for this code?
icount = 0
Me.PHQ_Depress_Diag.Value = 0 '"No Depression Disorder"
If Me.PHQ_01.Value > 1 Or Me.PHQ_02.Value > 1 Then
If Me.PHQ_01.Value > 1 Then icount = icount + 1
If Me.PHQ_02.Value > 1 Then icount = icount + 1
If Me.PHQ_03.Value > 1 Then icount = icount + 1
If Me.PHQ_04.Value > 1 Then icount = icount + 1
If Me.PHQ_05.Value > 1 Then icount = icount + 1
If Me.PHQ_06.Value > 1 Then icount = icount + 1
If Me.PHQ_07.Value > 1 Then icount = icount + 1
If Me.PHQ_08.Value > 1 Then icount = icount + 1
If Me.PHQ_09.Value > 1 Then icount = icount + 1
If icount >= 5 Then
Me.PHQ_Depress_Diag.Value = 2 '"Major Depressive Disorder"
Else
If icount > 1 And icount < 5 Then
Me.PHQ_Depress_Diag.Value = 1 '"Other Depressive Disorder"
End If
End If
End If
new field and the current records being entered will do this but I also need
to update the old records also. So can anyone help guide me in making a
Update query for this code?
icount = 0
Me.PHQ_Depress_Diag.Value = 0 '"No Depression Disorder"
If Me.PHQ_01.Value > 1 Or Me.PHQ_02.Value > 1 Then
If Me.PHQ_01.Value > 1 Then icount = icount + 1
If Me.PHQ_02.Value > 1 Then icount = icount + 1
If Me.PHQ_03.Value > 1 Then icount = icount + 1
If Me.PHQ_04.Value > 1 Then icount = icount + 1
If Me.PHQ_05.Value > 1 Then icount = icount + 1
If Me.PHQ_06.Value > 1 Then icount = icount + 1
If Me.PHQ_07.Value > 1 Then icount = icount + 1
If Me.PHQ_08.Value > 1 Then icount = icount + 1
If Me.PHQ_09.Value > 1 Then icount = icount + 1
If icount >= 5 Then
Me.PHQ_Depress_Diag.Value = 2 '"Major Depressive Disorder"
Else
If icount > 1 And icount < 5 Then
Me.PHQ_Depress_Diag.Value = 1 '"Other Depressive Disorder"
End If
End If
End If