Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Compare Database
- Option Explicit
- ' Tømmer skjema når det lastes
- Private Sub Form_Load()
- Me.txtDiagnose = ""
- Me.txtJournal = ""
- Me.txtResept = ""
- End Sub
- Private Sub txtJournal_AfterUpdate()
- Dim i As Integer
- Dim j As Integer
- Dim reseptDel As String
- Dim diagnoseDel As String
- Dim missing_rTag As Module
- ' Lar programmet gå igjennom teksten tegn for tegn
- For i = 1 To Len(Me.txtJournal)
- ' Lager en under Loop for <resept> start-tag, med feilsjekking
- If Mid(Me.txtJournal, i, 8) = "<resept>" Then
- For j = i To Len(Me.txtJournal)
- If Mid(Me.txtJournal, j, 9) = "</resept>" Then
- reseptDel = Mid(Me.txtJournal, i + 8, j - (i + 8))
- Me.txtResept = Me.txtResept & " " & reseptDel
- i = j
- Exit For
- ElseIf Mid(Me.txtJournal, j, 10) = "<diagnose>" Then
- GoTo rTag
- ElseIf Mid(Me.txtJournal, j, 11) = "</diagnose>" Then
- GoTo rTag
- ElseIf Mid(Me.txtJournal, j, 8) = "<resept>" And j > 8 Then
- GoTo rTag
- ElseIf (j + 8) = Len(Me.txtJournal) Then
- GoTo rTag
- End If
- Next j
- End If
- ' Lager en under Loop for <diagnose> tagen med feilsjekking
- If Mid(Me.txtJournal, i, 10) = "<diagnose>" Then
- For j = i To Len(Me.txtJournal)
- If Mid(Me.txtJournal, j, 11) = "</diagnose>" Then
- diagnoseDel = Mid(Me.txtJournal, i + 10, j - (i + 10))
- Me.txtDiagnose = Me.txtDiagnose & " " & diagnoseDel
- i = j
- Exit For
- ElseIf Mid(Me.txtJournal, j, 8) = "<resept>" Then
- GoTo dTag
- ElseIf Mid(Me.txtJournal, j, 9) = "</resept>" Then
- GoTo dTag
- ElseIf Mid(Me.txtJournal, j, 10) = "<diagnose>" And j > 10 Then
- GoTo dTag
- ElseIf (j + 11) = Len(Me.txtJournal) Then
- GoTo dTag
- End If
- Next j
- End If
- Next i
- Exit Sub
- ' For rydde litt i koden, har jeg satt feilmeldingene som en GoTo
- rTag:
- Call MsgBox("Sjekk at rett antall tags for resept er brukt")
- Exit Sub
- dTag:
- Call MsgBox("Sjekk at rett antall tags for diagnose er brukt")
- Exit Sub
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement