L
LAS
I have a form that contains the following code 36 times (!!!). It varies
only in the digits. For every PB<x>_, there are six PB<y>s. I wish I could
have put it into a subroutine, probably with parameters "asPrimaryDigit,
asSecondaryDigit". I can see how to do it where the digits are in strings
(e.g., " Where code_group = .....). But I don't see how to handle the
controls (txtPB<x>_<y>), except for a 6 level case statement within a 6
level case statement. Is that the best I can do?
TIA
LAS
If Trim(isPB1_1Orig) <> txtPB1_1 Then
If isPB1_1Orig = "" Then
gs_sql = "Insert into tblCodes(Code_Group,Code,Description)" _
& "VALUES ('ProbBehave1', 'PB1-1', '" & txtPB1_1 & "')"
Else
gs_sql = "Update tblCodes set Description = '" & txtPB1_1 & "'" & _
" Where Code_Group = 'ProbBehave1' and Code = 'PB1-1'"
End If
Call CurrentDb.Execute(gs_sql, dbFailOnError)
If trim(isPB1_1Orig) <> "" Then
If ibModify Then
gs_sql = "Update tblStudentTracking Set ProbBehaveCat1_Desc = '"
& txtPB1_1 _
& "' Where ProbBehaveCat1_Desc = '" & isPB1_1Orig & "'"
Else
gs_sql = "Delete from tblStudentTracking " _
& " Where ProbBehaveCat1_Desc = '" & isPB1_1Orig & "'"
End If
Call CurrentDb.Execute(gs_sql, dbFailOnError)
End If
End If
only in the digits. For every PB<x>_, there are six PB<y>s. I wish I could
have put it into a subroutine, probably with parameters "asPrimaryDigit,
asSecondaryDigit". I can see how to do it where the digits are in strings
(e.g., " Where code_group = .....). But I don't see how to handle the
controls (txtPB<x>_<y>), except for a 6 level case statement within a 6
level case statement. Is that the best I can do?
TIA
LAS
If Trim(isPB1_1Orig) <> txtPB1_1 Then
If isPB1_1Orig = "" Then
gs_sql = "Insert into tblCodes(Code_Group,Code,Description)" _
& "VALUES ('ProbBehave1', 'PB1-1', '" & txtPB1_1 & "')"
Else
gs_sql = "Update tblCodes set Description = '" & txtPB1_1 & "'" & _
" Where Code_Group = 'ProbBehave1' and Code = 'PB1-1'"
End If
Call CurrentDb.Execute(gs_sql, dbFailOnError)
If trim(isPB1_1Orig) <> "" Then
If ibModify Then
gs_sql = "Update tblStudentTracking Set ProbBehaveCat1_Desc = '"
& txtPB1_1 _
& "' Where ProbBehaveCat1_Desc = '" & isPB1_1Orig & "'"
Else
gs_sql = "Delete from tblStudentTracking " _
& " Where ProbBehaveCat1_Desc = '" & isPB1_1Orig & "'"
End If
Call CurrentDb.Execute(gs_sql, dbFailOnError)
End If
End If