Sub Nomorotomatis

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Sub nomorotomatis()

'create no rekam medis otomatis


cmd = New OleDbCommand("select *from indeks where no_indeks in (select
max(no_indeks) from indeks) order by no_indeks desc", conn)
rd = cmd.ExecuteReader
rd.Read()
If rd.HasRows = 0 Then
NI.Text = "NI001"
rd.Close()
End If
If Not rd.HasRows Then
NI.Text = "NI" + "001"
rd.Close()
Else
NI.Text = Val(Microsoft.VisualBasic.Mid(rd.Item("no_indeks").ToString, 4, 3))
+ 1
If Len(NI.Text) = 1 Then
NI.Text = "TR000" & NI.Text & ""
ElseIf Len(NI.Text) = 2 Then
NI.Text = "TR00" & NI.Text & ""
ElseIf Len(NI.Text) = 3 Then
NI.Text = "TR00" & NI.Text & ""
End If
rd.Close()
End If
End Sub

You might also like