而不是硬編碼MS Access VBA中的分數和等級,我怎麼能將值放在一個表中,並從表中訪問它們?這樣,當分數範圍發生變化時,我不必回到vba代碼並更新它。我只是更新表格中的值,代碼只會提取分數範圍,並在該字段上分配正確的分數。請幫助...更改IF其他條件值從表
Private Sub MarkScored_Exit(Cancel As Integer)
Dim mScore As Integer
mScore = Nz(Forms![frmAssessmentDetails]![subfrmAcademicAssessment]![MarkScored])
If mScore >= 0 And mScore <= 10 Then
Forms![frmAssessmentDetails]![subfrmAcademicAssessment]![cboGradeCode] = "VLA"
ElseIf mScore > 10 And mScore <= 15 Then
Forms![frmAssessmentDetails]![subfrmAcademicAssessment]![cboGradeCode] = "LA"
ElseIf mScore > 15 And mScore <= 20 Then
Forms![frmAssessmentDetails]![subfrmAcademicAssessment]![cboGradeCode] = "S"
ElseIf mScore > 20 And mScore <= 25 Then
Forms![frmAssessmentDetails]![subfrmAcademicAssessment]![cboGradeCode] = "HA"
ElseIf mScore > 25 And mScore <= 30 Then
Forms![frmAssessmentDetails]![subfrmAcademicAssessment]![cboGradeCode] = "VHA"
Else
MsgBox "Please enter valid mark for Score between 0 and 30", vbOKCancel, "Invalid Number"
End If
末次
的1列我刪除了SQL Server的標籤,因爲這似乎是一個VBA訪問的問題。 –