Advertisement
Guest User

Oppgave8

a guest
Oct 31st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Compare Database
  2. Option Explicit
  3.  
  4.  
  5.  
  6.  
  7. Private Sub Form_Load()
  8.     Me.txtDiagnose = ""
  9.     Me.txtJournal = ""
  10.     Me.txtResept = ""
  11. End Sub
  12.  
  13.  
  14.  
  15.  
  16. Private Sub txtJournal_AfterUpdate()
  17.  
  18.     Dim i As Integer
  19.     Dim j As Integer
  20.     Dim reseptDel As String
  21.     Dim diagnoseDel As String
  22.     Dim missing_rTag As Module
  23.  
  24.  
  25.     For i = 1 To Len(Me.txtJournal)
  26.  
  27.  
  28.     If Mid(Me.txtJournal, i, 8) = "<resept>" Then
  29.  
  30.     For j = i To Len(Me.txtJournal)
  31.    
  32.         If Mid(Me.txtJournal, j, 9) = "</resept>" Then
  33.             reseptDel = Mid(Me.txtJournal, i + 8, j - (i + 8))
  34.             Me.txtResept = Me.txtResept & " " & reseptDel
  35.             i = j
  36.             Exit For
  37.            
  38.         ElseIf Mid(Me.txtJournal, j, 10) = "<diagnose>" Then
  39.             GoTo rTag
  40.         ElseIf Mid(Me.txtJournal, j, 11) = "</diagnose>" Then
  41.             GoTo rTag
  42.         ElseIf Mid(Me.txtJournal, j, 8) = "<resept>" And j > 8 Then
  43.             GoTo rTag
  44.         ElseIf (j + 8) = Len(Me.txtJournal) Then
  45.             GoTo rTag
  46.         End If
  47.        
  48.  
  49.        
  50.        
  51.  
  52.             Next j
  53.         End If
  54.  
  55.  
  56.     If Mid(Me.txtJournal, i, 10) = "<diagnose>" Then
  57.    
  58.         For j = i To Len(Me.txtJournal)
  59.             If Mid(Me.txtJournal, j, 11) = "</diagnose>" Then
  60.                 diagnoseDel = Mid(Me.txtJournal, i + 10, j - (i + 10))
  61.                 Me.txtDiagnose = Me.txtDiagnose & " " & diagnoseDel
  62.                 i = j
  63.                 Exit For
  64.             ElseIf Mid(Me.txtJournal, j, 8) = "<resept>" Then
  65.                 GoTo dTag
  66.             ElseIf Mid(Me.txtJournal, j, 9) = "</resept>" Then
  67.                 GoTo dTag
  68.             ElseIf Mid(Me.txtJournal, j, 10) = "<diagnose>" And j > 10 Then
  69.                 GoTo dTag
  70.             ElseIf (j + 11) = Len(Me.txtJournal) Then
  71.                GoTo dTag
  72.             End If
  73.        
  74.    
  75.        
  76.    
  77.    
  78.    
  79.    
  80.             Next j
  81.          End If
  82.                    
  83.     Next i
  84.  
  85.     Exit Sub
  86.  
  87. rTag:
  88.    
  89.     Call MsgBox("Sjekk at rett antall tags for resept er brukt", vbInformation)
  90.     Me.txtJournal.SetFocus
  91.     Exit Sub
  92.  
  93. dTag:
  94.     Call MsgBox("Sjekk at rett antall tags for diagnose er brukt", vbInformation)
  95.     Me.txtJournal.SetFocus
  96.     Exit Sub
  97.  
  98.  
  99.  
  100.  
  101. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement