For context, I am referring to Navy students on a Naval Intel base just out of boot camp who need to earn their expanded liberty. The higher the phase they are in, the more liberty they get.
Now...
I coded a way to determine what liberty phase my students are in VBA.
I created a query to determine who is phase one so we filter down the records to who needs to muster on Saturday and Sunday. If they are phase two, they do not.
In my form I made an unbound box that returns the result of the VBA code to determine their phase and it works like a charm.
[EDITED ADDED INFO]*At times students come in and are from other schools (language, BUD/s, etc) or we are the second stop after boot camp and we do not require them to be there a minimum of 14 days or pass a physical test since they have been in longer. We only require them to get their watch qualifications. The program sees that they are there less than 14 days and without code puts them on phase one, but with code puts them on phase two if they are those special cases. I am trying to get that query to recognize the special cases based off the code in VBA and the value returned.*
The problem is when I need to run a query, I cannot get the $#%ing query to look at the value of the unbound box per record to filter down to only students on phase one.
Here is the code used to determine their phase and return it in the form's unbound box called txtphase.
The name of the table used is currentstudents.
The name of the form used is N91 RECORDS
The name of the query used is phaseonequery
What am I to do? Where is my failure here? Thanks.
Now...
I coded a way to determine what liberty phase my students are in VBA.
I created a query to determine who is phase one so we filter down the records to who needs to muster on Saturday and Sunday. If they are phase two, they do not.
In my form I made an unbound box that returns the result of the VBA code to determine their phase and it works like a charm.
[EDITED ADDED INFO]*At times students come in and are from other schools (language, BUD/s, etc) or we are the second stop after boot camp and we do not require them to be there a minimum of 14 days or pass a physical test since they have been in longer. We only require them to get their watch qualifications. The program sees that they are there less than 14 days and without code puts them on phase one, but with code puts them on phase two if they are those special cases. I am trying to get that query to recognize the special cases based off the code in VBA and the value returned.*
The problem is when I need to run a query, I cannot get the $#%ing query to look at the value of the unbound box per record to filter down to only students on phase one.
Here is the code used to determine their phase and return it in the form's unbound box called txtphase.
Code:
Dim a As Integer, b As Integer, c As Integer, d As Integer, phasenumber As Integer
If Me.rover = True Then
a = 2
End If
If Me.messenger = True Then
b = 2
End If
If Me.mockprt = "PASS" Then
c = 2
Else
If Me.daysonboard < 14 And Me.mockprt = "NA" Then
c = 4
End If
End If
If Me.daysonboard > 13 Then
d = 2
End If
If a + b + c + d = 8 Then
phasenumber = 2
Else
phasenumber = 1
End If
txtphase = phasenumber
The name of the form used is N91 RECORDS
The name of the query used is phaseonequery
What am I to do? Where is my failure here? Thanks.
Last edited: