0% found this document useful (0 votes)
55 views6 pages

Coding Form Pasien

The document contains code for a form used to add, delete, and update patient records in Excel. The form code validates required fields, inserts new records into a worksheet, finds and deletes existing records, and updates cell values to modify records. It also initializes drop-down lists for status, gender, and patient type fields.

Uploaded by

Rasyid Dorkz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views6 pages

Coding Form Pasien

The document contains code for a form used to add, delete, and update patient records in Excel. The form code validates required fields, inserts new records into a worksheet, finds and deletes existing records, and updates cell values to modify records. It also initializes drop-down lists for status, gender, and patient type fields.

Uploaded by

Rasyid Dorkz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

CODING FORM PASIEN

Private Sub CMDADD_Click()

Dim DBPASIEN As Object

Set DBPASIEN = Sheet3.Range("B100000").End(xlUp)

If Me.TXTNORM.Value = "" _

Or Me.TXTNAMA.Value = "" _

Or Me.CBSTATUS.Value = "" _

Or Me.TXTTANGGALMASUK.Value = "" _

Or Me.TXTTANGGALLAHIR.Value = "" _

Or Me.TXTUSIA.Value = "" _

Or Me.CBJENISKELAMIN.Value = "" _

Or Me.TXTPEKERJAAN.Value = "" _

Or Me.TXTKTP.Value = "" _

Or Me.TXTJKN.Value = "" _

Or Me.TXTALERGI.Value = "" _

Or Me.CBPASIEN.Value = "" Then

Call MsgBox("Data Dokter harus lengkap", vbInformation, "Data Dokter")

Else

DBPASIEN.Offset(1, 0).Value = Me.TXTNORM.Value

DBPASIEN.Offset(1, 1).Value = Me.TXTNAMA.Value

DBPASIEN.Offset(1, 2).Value = Me.CBJENISKELAMIN.Value

DBPASIEN.Offset(1, 3).Value = Me.CBSTATUS.Value

DBPASIEN.Offset(1, 4).Value = Me.TXTTANGGALMASUK.Value

DBPASIEN.Offset(1, 5).Value = Me.TXTTANGGALLAHIR.Value


DBPASIEN.Offset(1, 6).Value = Me.TXTUSIA.Value

DBPASIEN.Offset(1, 7).Value = Me.TXTPEKERJAAN.Value

DBPASIEN.Offset(1, 8).Value = Me.TXTKTP.Value

DBPASIEN.Offset(1, 9).Value = Me.TXTJKN.Value

DBPASIEN.Offset(1, 10).Value = Me.TXTALERGI.Value

DBPASIEN.Offset(1, 11).Value = Me.CBPASIEN.Value

Call AutoNumberPasien

Call MsgBox("Data Dokter berhasil ditambah", vbInformation, "Data Dokter")

Me.TXTNORM.Value = ""

Me.TXTNAMA.Value = ""

Me.CBSTATUS.Value = ""

Me.TXTTANGGALMASUK.Value = ""

Me.TXTTANGGALLAHIR.Value = ""

Me.TXTUSIA.Value = ""

Me.CBJENISKELAMIN.Value = ""

Me.TXTPEKERJAAN.Value = ""

Me.TXTKTP.Value = ""

Me.TXTJKN.Value = ""

Me.TXTALERGI.Value = ""

Me.CBPASIEN.Value = ""

End If

End Sub

Private Sub CMDDELETE_Click()

If Me.TXTNORM.Value = "" Then

Call MsgBox("Pilih data pada tabel data", vbInformation, "Hapus Data")

Else
'Membuat pesan konfirmasi hapus data

Select Case MsgBox("Anda akan menghapus data" _

& vbCrLf & "Apakah anda yakin?" _

, vbYesNo Or vbQuestion Or vbDefaultButton1, "Hapus data")

Case vbNo

Exit Sub

Case vbYes

End Select

'Menentukan tempat hapus data, menghapus data dan membersihkan form

Set Hapusdata = Sheet3.Range("B5:B500000").Find(WHAT:=Me.TXTNORM.Value, LookIn:=xlValues)

Hapusdata.Offset(0, -1).ClearContents

Hapusdata.Offset(0, 0).ClearContents

Hapusdata.Offset(0, 1).ClearContents

Hapusdata.Offset(0, 2).ClearContents

Hapusdata.Offset(0, 3).ClearContents

Hapusdata.Offset(0, 4).ClearContents

Hapusdata.Offset(0, 5).ClearContents

Hapusdata.Offset(0, 6).ClearContents

Hapusdata.Offset(0, 7).ClearContents

Hapusdata.Offset(0, 8).ClearContents

Hapusdata.Offset(0, 9).ClearContents

Hapusdata.Offset(0, 10).ClearContents

Hapusdata.Offset(0, 11).ClearContents

Call MsgBox("Data berhasil dihapus", vbInformation, "Hapus Data")

Me.TXTNORM.Value = ""

Me.TXTNAMA.Value = ""

Me.CBSTATUS.Value = ""

Me.TXTTANGGALMASUK.Value = ""
Me.TXTTANGGALLAHIR.Value = ""

Me.TXTUSIA.Value = ""

Me.CBJENISKELAMIN.Value = ""

Me.TXTPEKERJAAN.Value = ""

Me.TXTKTP.Value = ""

Me.TXTJKN.Value = ""

Me.TXTALERGI.Value = ""

Me.CBPASIEN.Value = ""

Call UrutPasien

Call AutoNumberPasien

End If

End Sub

Private Sub CMDUPDATE_Click()

Application.ScreenUpdating = False

Dim BARIS As String

If Me.TXTNORM.Text = "" Then

Call MsgBox("Pilih data terlebih dahulu", vbInformation, "Pilih Data")

Else

Sheet3.Select

BARIS = ActiveCell.Row

Cells(BARIS, 2) = Me.TXTNORM.Value

Cells(BARIS, 3) = Me.TXTNAMA.Value

Cells(BARIS, 4) = Me.CBJENISKELAMIN.Value

Cells(BARIS, 5) = Me.CBSTATUS.Value
Cells(BARIS, 6) = Me.TXTTANGGALMASUK.Value

Cells(BARIS, 7) = Me.TXTTANGGALLAHIR.Value

Cells(BARIS, 8) = Me.TXTUSIA.Value

Cells(BARIS, 9) = Me.TXTPEKERJAAN.Value

Cells(BARIS, 10) = Me.TXTKTP.Value

Cells(BARIS, 11) = Me.TXTJKN.Value

Cells(BARIS, 12) = Me.TXTALERGI.Value

Cells(BARIS, 13) = Me.CBPASIEN.Value

Call MsgBox("Data berhasil diubah", vbInformation, "Ubah Data")

Me.TXTNORM.Value = ""

Me.TXTNAMA.Value = ""

Me.CBSTATUS.Value = ""

Me.TXTTANGGALMASUK.Value = ""

Me.TXTTANGGALLAHIR.Value = ""

Me.TXTUSIA.Value = ""

Me.CBJENISKELAMIN.Value = ""

Me.TXTPEKERJAAN.Value = ""

Me.TXTKTP.Value = ""

Me.TXTJKN.Value = ""

Me.TXTALERGI.Value = ""

Me.CBPASIEN.Value = ""

End If

Sheet1.Select

End Sub

Private Sub UserForm_Initialize()

With CBSTATUS
.AddItem "Tn"

.AddItem "Ny"

.AddItem "An"

End With

With CBJENISKELAMIN

.AddItem "Laki - Laki"

.AddItem "Perempuan"

End With

With CBPASIEN

.AddItem "BPJS"

.AddItem "KIS"

.AddItem "ASKES"

.AddItem "UMUM"

End With

End Sub

You might also like