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

📄 start2.frm

📁 可以批量生成学生学号
💻 FRM
字号:
VERSION 5.00
Begin VB.Form start2 
   Caption         =   "Form1"
   ClientHeight    =   2496
   ClientLeft      =   48
   ClientTop       =   336
   ClientWidth     =   3960
   LinkTopic       =   "Form1"
   ScaleHeight     =   2496
   ScaleWidth      =   3960
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command3 
      Caption         =   "完成"
      Height          =   372
      Left            =   720
      TabIndex        =   10
      Top             =   1200
      Width           =   852
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   372
      Left            =   2280
      TabIndex        =   9
      Top             =   1200
      Width           =   732
   End
   Begin VB.TextBox Text4 
      Height          =   264
      Left            =   3480
      TabIndex        =   8
      Top             =   480
      Width           =   372
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   372
      Left            =   720
      TabIndex        =   6
      Top             =   1200
      Width           =   852
   End
   Begin VB.TextBox Text3 
      Height          =   264
      Left            =   2640
      TabIndex        =   5
      Top             =   480
      Width           =   372
   End
   Begin VB.TextBox Text2 
      Height          =   264
      Left            =   1560
      TabIndex        =   3
      Top             =   480
      Width           =   492
   End
   Begin VB.TextBox Text1 
      Height          =   264
      Left            =   600
      TabIndex        =   0
      Top             =   480
      Width           =   492
   End
   Begin VB.Label Label4 
      Caption         =   "班级"
      Height          =   252
      Left            =   2160
      TabIndex        =   7
      Top             =   480
      Width           =   372
   End
   Begin VB.Label Label3 
      Caption         =   "人数"
      Height          =   252
      Left            =   3120
      TabIndex        =   4
      Top             =   480
      Width           =   372
   End
   Begin VB.Label Label2 
      Caption         =   "专业"
      Height          =   252
      Left            =   1200
      TabIndex        =   2
      Top             =   480
      Width           =   372
   End
   Begin VB.Label Label1 
      Caption         =   "年级"
      Height          =   252
      Left            =   120
      TabIndex        =   1
      Top             =   480
      Width           =   492
   End
End
Attribute VB_Name = "start2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Do
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Then
    myexit1 = MsgBox("参数遗漏,请重新确认!", vbOKOnly)
    If myexit1 = vbOK Then
      Unload Me
    End If
    Exit Do
End If
 
i = 1
t = CStr(Text1.Text) + CStr(Text2.Text) + CStr(Text3.Text)

Dim db As New ADODB.Connection
  db.CursorLocation = adUseClient
  db.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=" & path & "teachmanage.mdb;"

Dim rs1 As New ADODB.Recordset
  l = "select id from student where id between '" & t & "01' and '" & t & "99' "
 rs1.Open l, db, adOpenStatic, adLockOptimistic
 If rs1.RecordCount > 0 Then
  myexit = MsgBox("操作错误,本班已进行补始化!", vbOKOnly, "错误")
  If myexit = vbOK Then
   Unload Me
   Exit Do
  End If
  Else
  Do While i <= CLng(Text4.Text)
    If i < 10 Then
      o = t + "0" + CStr(i)
    Else
      o = t + CStr(i)
    End If
  rs1.AddNew
  rs1("id") = o
  rs1.Update
  i = i + 1
  Loop
End If
db.Close
Command3.Visible = True
Command1.Enabled = False
Command1.Visible = False
Loop While myexit1 <> vbOK
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Form_Load()
Command3.Visible = False

End Sub

⌨️ 快捷键说明

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