基于Access 2003数据库开发设计的教学管理系统-大学毕业论文毕业设计学位论文范文

发布时间 : 星期二 文章基于Access 2003数据库开发设计的教学管理系统-大学毕业论文毕业设计学位论文范文更新完毕开始阅读

代码Private Sub Form_Current()

' Update the caption and fill in the list of options.

Me.Caption = Nz(Me![ItemText], \ FillOptions End Sub

Private Sub FillOptions()

' Fill in the options for this switchboard page.

' The number of buttons on the form. Const conNumButtons = 8

Dim con As Object Dim rs As Object Dim stSql As String

Dim intOption As Integer

' Set the focus to the first button on the form, ' and then hide all of the buttons on the form

' but the first. You can't hide the field with the focus. Me![Option1].SetFocus

For intOption = 2 To conNumButtons

Me(\

Me(\ Next intOption

' Open the table of Switchboard Items, and find ' the first item for this Switchboard Page.

Set con = Application.CurrentProject.Connection stSql = \

stSql = stSql & \Me![SwitchboardID]

stSql = stSql & \ Set rs = CreateObject(\ rs.Open stSql, con, 1 ' 1 = adOpenKeyset

' If there are no options for this Switchboard Page,

' display a message. Otherwise, fill the page with the items. If (rs.EOF) Then

Me![OptionLabel1].Caption = \此切换面板页上无项目。\ Else

While (Not (rs.EOF))

Me(\

Me(\ Me(\& rs![ItemNumber]).Caption = rs![ItemText] rs.MoveNext Wend End If

' Close the recordset and the database. rs.Close

Set rs = Nothing Set con = Nothing

End Sub

Private Function HandleButtonClick(intBtn As Integer) ' This function is called when a button is clicked. ' intBtn indicates which button was clicked.

' Constants for the commands that can be executed. Const conCmdGotoSwitchboard = 1 Const conCmdOpenFormAdd = 2 Const conCmdOpenFormBrowse = 3 Const conCmdOpenReport = 4

Const conCmdCustomizeSwitchboard = 5 Const conCmdExitApplication = 6

Const conCmdRunMacro = 7 Const conCmdRunCode = 8 Const conCmdOpenPage = 9

' An error that is special cased. Const conErrDoCmdCancelled = 2501

Dim con As Object Dim rs As Object Dim stSql As String

On Error GoTo HandleButtonClick_Err

' Find the item in the Switchboard Items table

' that corresponds to the button that was clicked. Set con = Application.CurrentProject.Connection Set rs = CreateObject(\

stSql = \

stSql = stSql & \[SwitchboardID]=\& Me![SwitchboardID] & \AND [ItemNumber]=\

rs.Open stSql, con, 1 ' 1 = adOpenKeyset

' If no item matches, report the error and exit the function. If (rs.EOF) Then

MsgBox \读取 Switchboard Items 表时出错。\ rs.Close

Set rs = Nothing Set con = Nothing Exit Function End If

Select Case rs![Command]

' Go to another switchboard. Case conCmdGotoSwitchboard

Me.Filter = \= 0 AND [SwitchboardID]=\& rs![Argument]

' Open a form in Add mode. Case conCmdOpenFormAdd

DoCmd.OpenForm rs![Argument], , , , acAdd

' Open a form.

Case conCmdOpenFormBrowse

联系合同范文客服:xxxxx#qq.com(#替换为@)