⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.frm

📁 运动会成绩统计系统。运动员的添加
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   Caption         =   "成绩录入"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4305
   LinkTopic       =   "Form2"
   ScaleHeight     =   3195
   ScaleWidth      =   4305
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame1 
      Caption         =   "运动员成绩录入"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2895
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4095
      Begin VB.CommandButton Command3 
         Caption         =   "退出"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2760
         TabIndex        =   9
         Top             =   2040
         Width           =   1095
      End
      Begin VB.CommandButton Command2 
         Caption         =   "重置"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2760
         TabIndex        =   8
         Top             =   1200
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "录入"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2760
         TabIndex        =   7
         Top             =   360
         Width           =   1095
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   960
         TabIndex        =   6
         Top             =   1800
         Width           =   1335
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   840
         Style           =   2  'Dropdown List
         TabIndex        =   3
         Top             =   1200
         Width           =   1335
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   1200
         TabIndex        =   2
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label3 
         Caption         =   "成绩"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   5
         Top             =   1920
         Width           =   615
      End
      Begin VB.Label Label2 
         Caption         =   "项目"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   4
         Top             =   1200
         Width           =   615
      End
      Begin VB.Label Label1 
         Caption         =   "运动员编号"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   1
         Top             =   480
         Width           =   975
      End
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo ErrMsg
'Dim a As String
'Dim sql2 As String
'Public adors1 As ADODB.Recordset
'Dim fld As ADODB.Field
Dim sql As String
If Text1.Text = "" Or Text2.Text = "" Or Combo1.Text = "" Then
    MsgBox "您没有填好内容!", vbOKOnly + vbExclamation, "系统提示"
    Exit Sub
End If
Set adors = adocon.Execute("Select a_no4119," & Combo1.Text & " From 运动项目及参赛表m4119 where a_no4119=" & Text1.Text & " and " & Combo1.Text & "='1'")
If adors.EOF Then
    MsgBox "运动员没有参加此项目或无此运动员!", vbOKOnly + vbExclamation, "系统提示"
    Exit Sub
End If
Set adors = adocon.Execute("select a_no4119 from 运动项目及成绩表m4119 where a_no4119=" & Text1.Text & "")
If adors.EOF Then
   adocon.Execute ("insert into 运动项目及成绩表m4119(a_no4119) values(" & Text1.Text & ")")
   Exit Sub
End If
sql = "update 运动项目及成绩表m4119 set " & Combo1.Text & "='" & Text2.Text & "' where " & Text1.Text & "=a_no4119"
adocon.Execute (sql)
'Set adors = adocon.Execute("select top 3 a_no4119 ," & Combo1.Text & " from 运动项目及成绩表m4119 order by " & Combo1.Text & " desc")
'Set adors1 = adocon.Execute("select *from 运动员奖牌表4119")
'If adors1.BOF And adors1.EOF Then adocon.Execute ("")
'adors (0)
'adocon.Execute ("insert into 运动员奖牌表4119(a_no4119,i1_name4119) values(adors(" & Combo1.Text & "))")

ErrMsg:
  If Err.Number <> 0 Then
      MsgBox Err.Number & Err.Description, vbOKOnly + vbCritical, "出错提示"
     Exit Sub
  End If
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
'Combo1.Clear

End Sub

Private Sub Command3_Click()
Unload Me
'MDIForm1.Show

End Sub

Private Sub Form_Load()
Dim sql1 As String
sql1 = "select i_name4119 from 运动项目表4119"
Set adors = adocon.Execute(sql1)
Do While adors.EOF = False
Combo1.AddItem adors(0)
adors.MoveNext
Loop
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -