Hi All,
So I've got a pretty large form that is pulling together records from many different tables. It's designed to replicate the paperwork my coworkers will be reading to enter the data (kind of an annual audit). A fair amount of this data is simply being presented on the form so we can verify our information is still correct. In some cases we have never gotten around to entering this information so a few of these fields will be entered once and then, assuming no changes, verified. However, I'm running into a problem that I've tried several workarounds and I'm hitting a wall on and I hope someone can offer some suggestions. For background, this audit is on customers who are college students and each student will have as many audit records as they have years in college.
Here's the issue:
One of the fields to be filled out is the number of units required for full time status (College course units, full time student status). This value is associated with specific colleges so it is found on the Schools table. However, there are three fields one for each degree type we deal with (BS, MS, PhD). This means there are three fields associated with this unit requirement, but only one ever applies to each individual record (based on the school attended and degree level pursued). I have figured out how to use an empty text box and then add that value to the correct record in the Schools table based on School attended and degree pursued using the following code:
Code:
Dim strSQL As String, ReqUnits As Integer, Degree As String
Select Case Me.Degree.Value
Case "BS"
Degree = "[Unit Requirement: BS]"
Case "MS"
Degree = "[Unit Requirement: MS]"
Case "PhD"
Degree = "[Unit Requirement: PhD]"
End Select
ReqUnits = Me.txtReqUnits.Value
Debug.Print ReqUnits
strSQL = "UPDATE Schools SET " & Degree & "='" & ReqUnits & "' " & _
"WHERE School='" & Me.School.Value & "';"
DoCmd.RunSQL strSQL
However, my problem is that I want to also have an accompanying box that displays this once there is a value in that field. I've tried using a combo box and the code that I will add here in just a little bit. My problem there is the combo box appears blank unless I click on it and when the drop down menu appears, there is the correct value. Is there a cleaner way to present this data?
Code for combo box row source:
Code:
Dim strSQL As String, strDEGREE As String
Select Case Me.Degree.Value
Case "BS"
strDEGREE = " Schools.[Unit Requirement: BS]"
Case "MS"
strDEGREE = " Schools.[Unit Requirement: MS]"
Case "PhD"
strDEGREE = " Schools.[Unit Requirement: PhD]"
End Select
strSQL = "SELECT PartInfo.[Smart Id]," & strDEGREE & _
" FROM ARPT INNER JOIN (Schools INNER JOIN PartInfo ON Schools.School = PartInfo.School) ON ARPT.SMARTID = PartInfo.[Smart Id];"
Debug.Print strSQL
Me.cboReqUnits.RowSource = strSQL