Form of data form
Form data form is a form that serves to record all
the forms that exist in this school application program. In this form all of
the form will be validated to be accessible by
users who will
use this application. Recorded
on this form is
form id, form name
and the codes of
all the forms that exist in this
application program. Codes here
will be used to perform
against a user who
will have access to a form. All
forms that are not registered on this form
will never be opened by the user and the
user who does not have access
rights also can’t access the form.
To perform the data input form can
only be done by the user to
type an administrator only. And at the other user to see the form that is
not accessible then the user
should be reported to the administrator user in order form can be
immediately accessible. Forms that
are not accessible will not be displayed
to the screen. It is intended to prevent duplication
by those who are not interested.
To make this form will need to be made are as following
:
Object
|
Properties
|
Setting
|
Form
|
Name
|
FrmDataForm
|
BorderStyle
|
0-None
|
|
BackColor
|
&H00FFC0C0&
|
|
StartUpPosition
|
2-CenterScreen
|
|
ShowInTaskBar
|
1-True
|
|
aicAlphaImage
|
Name
|
aicAlphaImage1
|
ScaleMethod
|
1-aiStretch
|
|
Picture
|
As you wish
|
|
Basform
|
Name
|
Basform1
|
ButtonMax
|
False
|
|
ButtonMin
|
False
|
|
Shape
|
Name
|
Shape1
|
BackStyle
|
0-tranparent
|
|
BorderStyle
|
1-Solid
|
|
BorderColor
|
&H0000DDFF&
|
|
BorderWidth
|
2
|
|
FillStyle
|
1-Tranparent
|
|
Label
|
Name
|
Label1
|
Captian
|
Data Form of Forms
|
|
Font
|
Dodger
|
|
FoceColor
|
&H0000DDFF&
|
|
Name
|
Label2
|
|
Captian
|
Form ID
|
|
Font
|
Dodger
|
|
FoceColor
|
&H0000DDFF&
|
|
Name
|
Label3
|
|
Captian
|
Form Name
|
|
Font
|
Dodger
|
|
FoceColor
|
&H0000DDFF&
|
|
TextBox
|
Name
|
TxtFormID
|
Appearance
|
0-Flat
|
|
Height
|
330
|
|
Name
|
TxtFormName
|
|
Appearance
|
0-Flat
|
|
Height
|
330
|
|
Name
|
TxtID
|
|
Appearance
|
0-Flat
|
|
Height
|
330
|
|
Visible
|
False
|
|
TDBGrid
|
Name
|
Grid
|
Columns(0)
|
Caption
|
Form ID
|
DataField
|
FormID
|
|
Columns(1)
|
Caption
|
Form Name
|
DataField
|
FormName
|
|
VBButton
|
Name
|
CmdAdd
|
ButtonType
|
3-Windows XP
|
|
Caption
|
&Add
|
|
Name
|
CmdEdit
|
|
ButtonType
|
3-Windows XP
|
|
Caption
|
&Edit
|
|
Name
|
CmdDelete
|
|
ButtonType
|
3-Windows XP
|
|
Caption
|
&Delete
|
|
Name
|
CmdSave
|
|
ButtonType
|
3-Windows XP
|
|
Caption
|
&Save
|
|
Name
|
CmdCancel
|
|
ButtonType
|
3-Windows XP
|
|
Caption
|
&Cancel
|
|
Name
|
CmdQuit
|
|
ButtonType
|
3-Windows XP
|
|
Caption
|
&Quit
|
Semua
komponen tersebut diatur dan ditata sesuai dengan keinginan masing-masing dan
menjadi seperti ini:
All components are arranged and organized in
accordance with the wishes of each
and to be like this:
At the first run all the fields blank
and can not be filled due to be locked. To
enter new data then pressed the Add button. After that field can be
filled with data. To save it pressed the
Save button and if you want to cancel is pressed the Cancel button. To changing data already exists then pressed the Edit button or click 2 times on a
row of data in
question on the table.
After that the data will appear in the
columns field, and now the data can be
changed but that can change
only the data of
the form name only. To save the data changes on the Save button is pressed and pressed the Cancel button to cancel it. And
to delete the existing data,
click data in the
table and pressed the Delete key.
And to operate all functions of the
form properly and correctly below
it is the source code form data form:
Dim Edit As
Boolean
Sub
RefreshData()
Grid.DataSource
= Nothing
SQL =
"Select * from FormX"
Set
Grid.DataSource = DbCon.Execute(SQL)
Grid.Refresh
End Sub
Public Sub
CmdAdd_Click()
Edit = False
Form_Load
Tombol Me,
False
TxtFormID.Locked
= False
TxtFormName.Locked
= False
TxtFormID.BackColor
= vbWhite
TxtFormID.ForeColor
= vbBlack
TxtFormID.SetFocus
End Sub
Private Sub
CmdCancel_Click()
Form_Load
End Sub
Private Sub
CmdDelete_Click()
Edit = False
Tombol Me,
False
TxtFormID =
Trim(Grid.Columns(0).Text)
TxtFormName =
Trim(Grid.Columns(1).Text)
TxtFormID.Locked
= True
TxtFormName.Locked
= True
If
MsgBox("Are You Sure to Delete This??", vbCritical + vbYesNo) = vbYes
Then
SQL = "delete from FormX where
formid='" & Trim(TxtFormID.Text) & "'"
DbCon.Execute SQL
MsgBox "Data Deleted"
End If
RefreshData
End Sub
Private Sub
CmdEdit_Click()
Grid_DblClick
End Sub
Private Sub
CmdQuit_Click()
Unload Me
End Sub
Private Sub
CmdSave_Click()
Dim Code As
String
If
Trim(TxtFormID.Text) = "" Then
MsgBox "Form ID Still Blank"
Exit Sub
ElseIf
Trim(TxtFormName.Text) = "" Then
MsgBox "Form Name Still Blank"
Exit Sub
End If
Code =
Trans.encryp_pass(25, Trim(TxtFormName.Text))
If Not Edit
Then
SQL = "insert into formX
values('" & Trim(TxtFormID.Text) & "','" & Trim(TxtFormName.Text)
& _
"','" & Code &
"')"
DbCon.Execute SQL
MsgBox "Data Saved"
Form_Load
RefreshData
Else
SQL = "update FormX Set
FormName='" & Trim(TxtFormName.Text) & "' where
FormID='" & Trim(TxtFormID.Text) & "'"
DbCon.Execute SQL
MsgBox "Data Updated"
Form_Load
RefreshData
End If
End Sub
Private Sub
Form_Activate()
CekForm Me,
TxtID
End Sub
Private Sub
Form_Load()
Tombol Me,
True
TxtID =
"A01-02-01"
Me.Width =
Me.BasForm1.Width
Me.Height =
Me.BasForm1.Height
Bersih
TxtFormID.Locked
= True
TxtFormName.Locked
= True
TxtFormID.BackColor
= vbWhite
TxtFormID.ForeColor
= vbBlack
Edit = False
RefreshData
End Sub
Sub Bersih()
TxtFormID =
""
TxtFormName =
""
End Sub
Private Sub
Grid_DblClick()
Edit = True
Tombol Me,
False
TxtFormID =
Trim(Grid.Columns(0).Text)
TxtFormName =
Trim(Grid.Columns(1).Text)
TxtFormID.Locked
= True
TxtFormName.Locked
= False
TxtFormID.BackColor
= vbRed
TxtFormID.ForeColor
= vbWhite
End Sub
Private Sub
TxtFormID_KeyPress(KeyAscii As Integer)
KeyAscii =
UpCase(KeyAscii)
End Sub
Watch and Learn
Comments
Post a Comment