Розробка інформаційної системи процесу оцінювання успішності учнів

Документація, яка ведеться при аналізі успішності учнів загальноосвітньої школи. Проектування бази даних та її структура. Розробка програмного забезпечення інформаційної системи. Структура програмного забезпечення. Інсталяція інформаційної системи.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык украинский
Дата добавления 27.07.2015
Размер файла 2,1 M

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

adoPrimaryRS.MoveLast 'move to the new record

End If

mbEditFlag = False

mbAddNewFlag = False

SetButtons True

mbDataChanged = False

Exit Sub

UpdateErr:

MsgBox Err.Description

End Sub

Private Sub cmdClose_Click()

Unload Me

End Sub

Private Sub cmdFirst_Click()

On Error GoTo GoFirstError

adoPrimaryRS.MoveFirst

mbDataChanged = False

Exit Sub

GoFirstError:

MsgBox Err.Description

End Sub

Private Sub cmdLast_Click()

On Error GoTo GoLastError

adoPrimaryRS.MoveLast

mbDataChanged = False

Exit Sub

GoLastError:

MsgBox Err.Description

End Sub

Private Sub cmdNext_Click()

On Error GoTo GoNextError

If Not adoPrimaryRS.EOF Then adoPrimaryRS.MoveNext

If adoPrimaryRS.EOF And adoPrimaryRS.RecordCount > 0 Then

Beep

'moved off the end so go back

adoPrimaryRS.MoveLast

End If

'show the current record

mbDataChanged = False

Exit Sub

GoNextError:

MsgBox Err.Description

End Sub

Private Sub cmdPrevious_Click()

On Error GoTo GoPrevError

If Not adoPrimaryRS.BOF Then adoPrimaryRS.MovePrevious

If adoPrimaryRS.BOF And adoPrimaryRS.RecordCount > 0 Then

Beep

'moved off the end so go back

adoPrimaryRS.MoveFirst

End If

'show the current record

mbDataChanged = False

Exit Sub

GoPrevError:

MsgBox Err.Description

End Sub

Private Sub SetButtons(bVal As Boolean)

cmdAdd.Visible = bVal

cmdUpdate.Visible = Not bVal

cmdCancel.Visible = Not bVal

cmdDelete.Visible = bVal

cmdClose.Visible = bVal

cmdNext.Enabled = bVal

cmdFirst.Enabled = bVal

cmdLast.Enabled = bVal

cmdPrevious.Enabled = bVal

End Sub

Текст модуля “Вчителі”

Dim WithEvents adoPrimaryRS As Recordset

Dim mbChangedByCode As Boolean

Dim mvBookMark As Variant

Dim mbEditFlag As Boolean

Dim mbAddNewFlag As Boolean

Dim mbDataChanged As Boolean

Private Sub Form_Load()

Dim db As Connection

Set db = New Connection

db.CursorLocation = adUseClient

db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Диплом\диплом.mdb;"

Set adoPrimaryRS = New Recordset

adoPrimaryRS.Open "select вчитель from вчитель Order by вчитель", db, adOpenStatic, adLockOptimistic

Set grdDataGrid.DataSource = adoPrimaryRS

mbDataChanged = False

End Sub

Private Sub Form_Resize()

On Error Resume Next

'This will resize the grid when the form is resized

grdDataGrid.Height = Me.ScaleHeight - 30 - picButtons.Height - picStatBox.Height

lblStatus.Width = Me.Width - 1500

cmdNext.Left = lblStatus.Width + 700

cmdLast.Left = cmdNext.Left + 340

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If mbEditFlag Or mbAddNewFlag Then Exit Sub

Select Case KeyCode

Case vbKeyEscape

cmdClose_Click

Case vbKeyEnd

cmdLast_Click

Case vbKeyHome

cmdFirst_Click

Case vbKeyUp, vbKeyPageUp

If Shift = vbCtrlMask Then

cmdFirst_Click

Else

cmdPrevious_Click

End If

Case vbKeyDown, vbKeyPageDown

If Shift = vbCtrlMask Then

cmdLast_Click

Else

cmdNext_Click

End If

End Select

End Sub

Private Sub Form_Unload(Cancel As Integer)

Screen.MousePointer = vbDefault

End Sub

Private Sub adoPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

'This will display the current record position for this recordset

lblStatus.Caption = "Запис: " & CStr(adoPrimaryRS.AbsolutePosition)

End Sub

Private Sub cmdAdd_Click()

On Error GoTo AddErr

adoPrimaryRS.MoveLast

adoPrimaryRS.AddNew

grdDataGrid.SetFocus

Exit Sub

AddErr:

MsgBox Err.Description

End Sub

Private Sub adoPrimaryRS_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

'This is where you put validation code

'This event gets called when the following actions occur

Dim bCancel As Boolean

Select Case adReason

Case adRsnAddNew

Case adRsnClose

Case adRsnDelete

Case adRsnFirstChange

Case adRsnMove

Case adRsnRequery

Case adRsnResynch

Case adRsnUndoAddNew

Case adRsnUndoDelete

Case adRsnUndoUpdate

Case adRsnUpdate

End Select

If bCancel Then adStatus = adStatusCancel

End Sub

Private Sub cmdDelete_Click()

On Error GoTo DeleteErr

With adoPrimaryRS

.Delete

.MoveNext

If .EOF Then .MoveLast

End With

Exit Sub

DeleteErr:

MsgBox Err.Description

End Sub

Private Sub cmdEdit_Click()

On Error GoTo EditErr

lblStatus.Caption = "Edit record"

mbEditFlag = True

SetButtons False

Exit Sub

EditErr:

MsgBox Err.Description

End Sub

Private Sub cmdCancel_Click()

On Error Resume Next

SetButtons True

mbEditFlag = False

mbAddNewFlag = False

adoPrimaryRS.CancelUpdate

If mvBookMark > 0 Then

adoPrimaryRS.Bookmark = mvBookMark

Else

adoPrimaryRS.MoveFirst

End If

mbDataChanged = False

End Sub

Private Sub cmdUpdate_Click()

On Error GoTo UpdateErr

adoPrimaryRS.UpdateBatch adAffectAll

If mbAddNewFlag Then

adoPrimaryRS.MoveLast 'move to the new record

End If

mbEditFlag = False

mbAddNewFlag = False

SetButtons True

mbDataChanged = False

Exit Sub

UpdateErr:

MsgBox Err.Description

End Sub

Private Sub cmdClose_Click()

Unload Me

End Sub

Private Sub cmdFirst_Click()

On Error GoTo GoFirstError

adoPrimaryRS.MoveFirst

mbDataChanged = False

Exit Sub

GoFirstError:

MsgBox Err.Description

End Sub

Private Sub cmdLast_Click()

On Error GoTo GoLastError

adoPrimaryRS.MoveLast

mbDataChanged = False

Exit Sub

GoLastError:

MsgBox Err.Description

End Sub

Private Sub cmdNext_Click()

On Error GoTo GoNextError

If Not adoPrimaryRS.EOF Then adoPrimaryRS.MoveNext

If adoPrimaryRS.EOF And adoPrimaryRS.RecordCount > 0 Then

Beep

'moved off the end so go back

adoPrimaryRS.MoveLast

End If

'show the current record

mbDataChanged = False

Exit Sub

GoNextError:

MsgBox Err.Description

End Sub

Private Sub cmdPrevious_Click()

On Error GoTo GoPrevError

If Not adoPrimaryRS.BOF Then adoPrimaryRS.MovePrevious

If adoPrimaryRS.BOF And adoPrimaryRS.RecordCount > 0 Then

Beep

'moved off the end so go back

adoPrimaryRS.MoveFirst

End If

'show the current record

mbDataChanged = False

Exit Sub

GoPrevError:

MsgBox Err.Description

End Sub

Private Sub SetButtons(bVal As Boolean)

cmdAdd.Visible = bVal

cmdUpdate.Visible = Not bVal

cmdCancel.Visible = Not bVal

cmdDelete.Visible = bVal

cmdClose.Visible = bVal

cmdNext.Enabled = bVal

cmdFirst.Enabled = bVal

cmdLast.Enabled = bVal

cmdPrevious.Enabled = bVal

End Sub

Текст модуля “Учні”

Private Sub Form_Unload(Cancel As Integer)

Screen.MousePointer = vbDefault

End Sub

Private Sub datPrimaryRS_Error(ByVal ErrorNumber As Long, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, fCancelDisplay As Boolean)

'This is where you would put error handling code

'If you want to ignore errors, comment out the next line

'If you want to trap them, add code here to handle them

MsgBox "Data error event hit err:" & Description

End Sub

Private Sub datPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

'This will display the current record position for this recordset

datPrimaryRS.Caption = "Запис: " & CStr(datPrimaryRS.Recordset.AbsolutePosition)

End Sub

Private Sub datPrimaryRS_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

'This is where you put validation code

'This event gets called when the following actions occur

Dim bCancel As Boolean

Select Case adReason

Case adRsnAddNew

Case adRsnClose

Case adRsnDelete

Case adRsnFirstChange

Case adRsnMove

Case adRsnRequery

Case adRsnResynch

Case adRsnUndoAddNew

Case adRsnUndoDelete

Case adRsnUndoUpdate

Case adRsnUpdate

End Select

If bCancel Then adStatus = adStatusCancel

End Sub

Private Sub cmdAdd_Click()

On Error GoTo AddErr

datPrimaryRS.Recordset.AddNew

Exit Sub

AddErr:

MsgBox Err.Description

End Sub

Private Sub cmdDelete_Click()

On Error GoTo DeleteErr

With datPrimaryRS.Recordset

.Delete

.MoveNext

If .EOF Then .MoveLast

End With

Exit Sub

DeleteErr:

MsgBox Err.Description

End Sub

Private Sub cmdUpdate_Click()

On Error GoTo UpdateErr

datPrimaryRS.Recordset.UpdateBatch adAffectAll

Exit Sub

UpdateErr:

MsgBox Err.Description

End Sub

Private Sub cmdClose_Click()

Unload Me

End Sub

Текст модуля “Навчальні класи”

Dim WithEvents adoPrimaryRS As Recordset

Dim mbChangedByCode As Boolean

Dim mvBookMark As Variant

Dim mbEditFlag As Boolean

Dim mbAddNewFlag As Boolean

Dim mbDataChanged As Boolean

Private Sub Form_Load()

Dim db As Connection

Set db = New Connection

db.CursorLocation = adUseClient

db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Диплом\диплом.mdb;"

Set adoPrimaryRS = New Recordset

adoPrimaryRS.Open "select клас from клас Order by клас", db, adOpenStatic, adLockOptimistic

Set grdDataGrid.DataSource = adoPrimaryRS

mbDataChanged = False

End Sub

Private Sub Form_Resize()

On Error Resume Next

'This will resize the grid when the form is resized

grdDataGrid.Height = Me.ScaleHeight - 30 - picButtons.Height - picStatBox.Height

lblStatus.Width = Me.Width - 1500

cmdNext.Left = lblStatus.Width + 700

cmdLast.Left = cmdNext.Left + 340

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If mbEditFlag Or mbAddNewFlag Then Exit Sub

Select Case KeyCode

Case vbKeyEscape

cmdClose_Click

Case vbKeyEnd

cmdLast_Click

Case vbKeyHome

cmdFirst_Click

Case vbKeyUp, vbKeyPageUp

If Shift = vbCtrlMask Then

cmdFirst_Click

Else

cmdPrevious_Click

End If

Case vbKeyDown, vbKeyPageDown

If Shift = vbCtrlMask Then

cmdLast_Click

Else

cmdNext_Click

End If

End Select

End Sub

Private Sub Form_Unload(Cancel As Integer)

Screen.MousePointer = vbDefault

End Sub

Private Sub adoPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

'This will display the current record position for this recordset

lblStatus.Caption = "Запис: " & CStr(adoPrimaryRS.AbsolutePosition)

End Sub

Private Sub adoPrimaryRS_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

'This is where you put validation code

'This event gets called when the following actions occur

Dim bCancel As Boolean

Select Case adReason

Case adRsnAddNew

Case adRsnClose

Case adRsnDelete

Case adRsnFirstChange

Case adRsnMove

Case adRsnRequery

Case adRsnResynch

Case adRsnUndoAddNew

Case adRsnUndoDelete

Case adRsnUndoUpdate

Case adRsnUpdate

End Select

If bCancel Then adStatus = adStatusCancel

End Sub

Private Sub cmdAdd_Click()

On Error GoTo AddErr

adoPrimaryRS.MoveLast

adoPrimaryRS.AddNew

grdDataGrid.SetFocus

Exit Sub

AddErr:

MsgBox Err.Description

End Sub

Private Sub cmdDelete_Click()

On Error GoTo DeleteErr

With adoPrimaryRS

.Delete

.MoveNext

If .EOF Then .MoveLast

End With

Exit Sub

DeleteErr:

MsgBox Err.Description

End Sub

Private Sub cmdEdit_Click()

On Error GoTo EditErr

lblStatus.Caption = "Edit record"

mbEditFlag = True

SetButtons False

Exit Sub

EditErr:

MsgBox Err.Description

End Sub

Private Sub cmdCancel_Click()

On Error Resume Next

SetButtons True

mbEditFlag = False

mbAddNewFlag = False

adoPrimaryRS.CancelUpdate

If mvBookMark > 0 Then

adoPrimaryRS.Bookmark = mvBookMark

Else

adoPrimaryRS.MoveFirst

End If

mbDataChanged = False

End Sub

Private Sub cmdUpdate_Click()

On Error GoTo UpdateErr

adoPrimaryRS.UpdateBatch adAffectAll

If mbAddNewFlag Then

adoPrimaryRS.MoveLast 'move to the new record

End If

mbEditFlag = False

mbAddNewFlag = False

SetButtons True

mbDataChanged = False

Exit Sub

UpdateErr:

MsgBox Err.Description

End Sub

Private Sub cmdClose_Click()

Unload Me

End Sub

Private Sub cmdFirst_Click()

On Error GoTo GoFirstError

adoPrimaryRS.MoveFirst

mbDataChanged = False

Exit Sub

GoFirstError:

MsgBox Err.Description

End Sub

Private Sub cmdLast_Click()

On Error GoTo GoLastError

adoPrimaryRS.MoveLast

mbDataChanged = False

Exit Sub

GoLastError:

MsgBox Err.Description

End Sub

Private Sub cmdNext_Click()

On Error GoTo GoNextError

If Not adoPrimaryRS.EOF Then adoPrimaryRS.MoveNext

If adoPrimaryRS.EOF And adoPrimaryRS.RecordCount > 0 Then

Beep

'moved off the end so go back

adoPrimaryRS.MoveLast

End If

'show the current record

mbDataChanged = False

Exit Sub

GoNextError:

MsgBox Err.Description

End Sub

Private Sub cmdPrevious_Click()

On Error GoTo GoPrevError

If Not adoPrimaryRS.BOF Then adoPrimaryRS.MovePrevious

If adoPrimaryRS.BOF And adoPrimaryRS.RecordCount > 0 Then

Beep

'moved off the end so go back

adoPrimaryRS.MoveFirst

End If

'show the current record

mbDataChanged = False

Exit Sub

GoPrevError:

MsgBox Err.Description

End Sub

Private Sub SetButtons(bVal As Boolean)

cmdAdd.Visible = bVal

cmdUpdate.Visible = Not bVal

cmdCancel.Visible = Not bVal

cmdDelete.Visible = bVal

cmdClose.Visible = bVal

cmdNext.Enabled = bVal

cmdFirst.Enabled = bVal

cmdLast.Enabled = bVal

cmdPrevious.Enabled = bVal

End Sub

Текст модуля “Період оцінювання”

Dim WithEvents adoPrimaryRS As Recordset

Dim mbChangedByCode As Boolean

Dim mvBookMark As Variant

Dim mbEditFlag As Boolean

Dim mbAddNewFlag As Boolean

Dim mbDataChanged As Boolean

Private Sub Form_Load()

Dim db As Connection

Set db = New Connection

db.CursorLocation = adUseClient

db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Диплом\диплом.mdb;"

Set adoPrimaryRS = New Recordset

adoPrimaryRS.Open "select період_оцінювання from період_оцінювання", db, adOpenStatic, adLockOptimistic

Set grdDataGrid.DataSource = adoPrimaryRS

mbDataChanged = False

End Sub

Private Sub Form_Resize()

On Error Resume Next

'This will resize the grid when the form is resized

grdDataGrid.Height = Me.ScaleHeight - 30 - picButtons.Height - picStatBox.Height

lblStatus.Width = Me.Width - 1500

cmdNext.Left = lblStatus.Width + 700

cmdLast.Left = cmdNext.Left + 340

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If mbEditFlag Or mbAddNewFlag Then Exit Sub

Select Case KeyCode

Case vbKeyEscape

cmdClose_Click

Case vbKeyEnd

cmdLast_Click

Case vbKeyHome

cmdFirst_Click

Case vbKeyUp, vbKeyPageUp

If Shift = vbCtrlMask Then

cmdFirst_Click

Else

cmdPrevious_Click

End If

Case vbKeyDown, vbKeyPageDown

If Shift = vbCtrlMask Then

cmdLast_Click

Else

cmdNext_Click

End If

End Select

End Sub

Private Sub Form_Unload(Cancel As Integer)

Screen.MousePointer = vbDefault

End Sub

Private Sub adoPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

'This will display the current record position for this recordset

lblStatus.Caption = "Запис: " & CStr(adoPrimaryRS.AbsolutePosition)

End Sub

Private Sub adoPrimaryRS_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

'This is where you put validation code

'This event gets called when the following actions occur

Dim bCancel As Boolean

Select Case adReason

Case adRsnAddNew

Case adRsnClose

Case adRsnDelete

Case adRsnFirstChange

Case adRsnMove

Case adRsnRequery

Case adRsnResynch

Case adRsnUndoAddNew

Case adRsnUndoDelete

Case adRsnUndoUpdate

Case adRsnUpdate

End Select

If bCancel Then adStatus = adStatusCancel

End Sub

Private Sub cmdAdd_Click()

On Error GoTo AddErr

adoPrimaryRS.MoveLast

adoPrimaryRS.AddNew

grdDataGrid.SetFocus

Exit Sub

AddErr:

MsgBox Err.Description

End Sub

Private Sub cmdDelete_Click()

On Error GoTo DeleteErr

With adoPrimaryRS

.Delete

.MoveNext

If .EOF Then .MoveLast

End With

Exit Sub

DeleteErr:

MsgBox Err.Description

End Sub

Private Sub cmdEdit_Click()

On Error GoTo EditErr

lblStatus.Caption = "Edit record"

mbEditFlag = True

SetButtons False

Exit Sub

EditErr:

MsgBox Err.Description

End Sub

Private Sub cmdCancel_Click()

On Error Resume Next

SetButtons True

mbEditFlag = False

mbAddNewFlag = False

adoPrimaryRS.CancelUpdate

If mvBookMark > 0 Then

adoPrimaryRS.Bookmark = mvBookMark

Else

adoPrimaryRS.MoveFirst

End If

mbDataChanged = False

End Sub

Private Sub cmdUpdate_Click()

On Error GoTo UpdateErr

adoPrimaryRS.UpdateBatch adAffectAll

If mbAddNewFlag Then

adoPrimaryRS.MoveLast 'move to the new record

End If

mbEditFlag = False

mbAddNewFlag = False

SetButtons True

mbDataChanged = False

Exit Sub

UpdateErr:

MsgBox Err.Description

End Sub

Private Sub cmdClose_Click()

Unload Me

End Sub

Private Sub cmdFirst_Click()

On Error GoTo GoFirstError

adoPrimaryRS.MoveFirst

mbDataChanged = False

Exit Sub

GoFirstError:

MsgBox Err.Description

End Sub

Private Sub cmdLast_Click()

On Error GoTo GoLastError

adoPrimaryRS.MoveLast

mbDataChanged = False

Exit Sub

GoLastError:

MsgBox Err.Description

End Sub

Private Sub cmdNext_Click()

On Error GoTo GoNextError

If Not adoPrimaryRS.EOF Then adoPrimaryRS.MoveNext

If adoPrimaryRS.EOF And adoPrimaryRS.RecordCount > 0 Then

Beep

'moved off the end so go back

adoPrimaryRS.MoveLast

End If

'show the current record

mbDataChanged = False

Exit Sub

GoNextError:

MsgBox Err.Description

End Sub

Private Sub cmdPrevious_Click()

On Error GoTo GoPrevError

If Not adoPrimaryRS.BOF Then adoPrimaryRS.MovePrevious

If adoPrimaryRS.BOF And adoPrimaryRS.RecordCount > 0 Then

Beep

'moved off the end so go back

adoPrimaryRS.MoveFirst

End If

'show the current record

mbDataChanged = False

Exit Sub

GoPrevError:

MsgBox Err.Description

End Sub

Private Sub SetButtons(bVal As Boolean)

cmdAdd.Visible = bVal

cmdUpdate.Visible = Not bVal

cmdCancel.Visible = Not bVal

cmdDelete.Visible = bVal

cmdClose.Visible = bVal

cmdNext.Enabled = bVal

cmdFirst.Enabled = bVal

cmdLast.Enabled = bVal

cmdPrevious.Enabled = bVal

End Sub

Текст модуля “Сторінка вчителя”

Dim WithEvents adoPrimaryRS As Recordset

Dim mbChangedByCode As Boolean

Dim mvBookMark As Variant

Dim mbEditFlag As Boolean

Dim mbAddNewFlag As Boolean

Dim mbDataChanged As Boolean

Private Sub Form_Load()

Dim db As Connection

Set db = New Connection

db.CursorLocation = adUseClient

db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Диплом\диплом.mdb;"

Set adoPrimaryRS = New Recordset

adoPrimaryRS.Open "select вчитель,клас,навчальний_рік,період_оцінювання,предмет,код from Сторінка_вчителя Order by вчитель", db, adOpenStatic, adLockOptimistic

Dim oText As TextBox

'Bind the text boxes to the data provider

For Each oText In Me.txtFields

Set oText.DataSource = adoPrimaryRS

Next

Set Me.DataCombo1.DataSource = adoPrimaryRS

mbDataChanged = False

End Sub

Private Sub Form_Resize()

On Error Resume Next

lblStatus.Width = Me.Width - 1500

cmdNext.Left = lblStatus.Width + 700

cmdLast.Left = cmdNext.Left + 340

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If mbEditFlag Or mbAddNewFlag Then Exit Sub

Select Case KeyCode

Case vbKeyEscape

cmdClose_Click

Case vbKeyEnd

cmdLast_Click

Case vbKeyHome

cmdFirst_Click

Case vbKeyUp, vbKeyPageUp

If Shift = vbCtrlMask Then

cmdFirst_Click

Else

cmdPrevious_Click

End If

Case vbKeyDown, vbKeyPageDown

If Shift = vbCtrlMask Then

cmdLast_Click

Else

cmdNext_Click

End If

End Select

End Sub

Private Sub Form_Unload(Cancel As Integer)

Screen.MousePointer = vbDefault

End Sub

Private Sub adoPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

'This will display the current record position for this recordset

lblStatus.Caption = "Запис: " & CStr(adoPrimaryRS.AbsolutePosition)

End Sub

Private Sub adoPrimaryRS_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

'This is where you put validation code

'This event gets called when the following actions occur

Dim bCancel As Boolean

Select Case adReason

Case adRsnAddNew

Case adRsnClose

Case adRsnDelete

Case adRsnFirstChange

Case adRsnMove

Case adRsnRequery

Case adRsnResynch

Case adRsnUndoAddNew

Case adRsnUndoDelete

Case adRsnUndoUpdate

Case adRsnUpdate

End Select

If bCancel Then adStatus = adStatusCancel

End Sub

Private Sub cmdAdd_Click()

On Error GoTo AddErr

With adoPrimaryRS

If Not (.BOF And .EOF) Then

mvBookMark = .Bookmark

End If

.AddNew

lblStatus.Caption = "Add record"

mbAddNewFlag = True

SetButtons False

End With

Exit Sub

AddErr:

MsgBox Err.Description

End Sub

Private Sub cmdDelete_Click()

On Error GoTo DeleteErr

With adoPrimaryRS

.Delete

.MoveNext

If .EOF Then .MoveLast

End With

Exit Sub

DeleteErr:

MsgBox Err.Description

End Sub

Private Sub cmdEdit_Click()

On Error GoTo EditErr

lblStatus.Caption = "Edit record"

mbEditFlag = True

SetButtons False

Exit Sub

EditErr:

MsgBox Err.Description

End Sub

Private Sub cmdCancel_Click()

On Error Resume Next

SetButtons True

mbEditFlag = False

mbAddNewFlag = False

adoPrimaryRS.CancelUpdate

If mvBookMark > 0 Then

adoPrimaryRS.Bookmark = mvBookMark

Else

adoPrimaryRS.MoveFirst

End If

mbDataChanged = False

End Sub

Private Sub cmdUpdate_Click()

On Error GoTo UpdateErr

adoPrimaryRS.UpdateBatch adAffectAll

If mbAddNewFlag Then

adoPrimaryRS.MoveLast 'move to the new record

End If

mbEditFlag = False

mbAddNewFlag = False

SetButtons True

mbDataChanged = False

Exit Sub

UpdateErr:

MsgBox Err.Description

End Sub

Private Sub cmdClose_Click()

Unload Me

End Sub

Private Sub cmdFirst_Click()

On Error GoTo GoFirstError

adoPrimaryRS.MoveFirst

mbDataChanged = False

Exit Sub

GoFirstError:

MsgBox Err.Description

End Sub

Private Sub cmdLast_Click()

On Error GoTo GoLastError

adoPrimaryRS.MoveLast

mbDataChanged = False

Exit Sub

GoLastError:

MsgBox Err.Description

End Sub

Private Sub cmdNext_Click()

On Error GoTo GoNextError

If Not adoPrimaryRS.EOF Then adoPrimaryRS.MoveNext

If adoPrimaryRS.EOF And adoPrimaryRS.RecordCount > 0 Then

Beep

'moved off the end so go back

adoPrimaryRS.MoveLast

End If

'show the current record

mbDataChanged = False

Exit Sub

GoNextError:

MsgBox Err.Description

End Sub

Private Sub cmdPrevious_Click()

On Error GoTo GoPrevError

If Not adoPrimaryRS.BOF Then adoPrimaryRS.MovePrevious

If adoPrimaryRS.BOF And adoPrimaryRS.RecordCount > 0 Then

Beep

'moved off the end so go back

adoPrimaryRS.MoveFirst

End If

'show the current record

mbDataChanged = False

Exit Sub

GoPrevError:

MsgBox Err.Description

End Sub

Private Sub SetButtons(bVal As Boolean)

cmdAdd.Visible = bVal

cmdUpdate.Visible = Not bVal

cmdCancel.Visible = Not bVal

cmdDelete.Visible = bVal

cmdClose.Visible = bVal

cmdNext.Enabled = bVal

cmdFirst.Enabled = bVal

cmdLast.Enabled = bVal

cmdPrevious.Enabled = bVal

End Sub

Размещено на Allbest.ru

...

Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.