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

📄 旅客信息.frm

📁 vb access客房管理系统经典实例添加了模块与access连接
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form4 
   Caption         =   "旅客信息"
   ClientHeight    =   3645
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5715
   Icon            =   "旅客信息.frx":0000
   LinkTopic       =   "Form4"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   Picture         =   "旅客信息.frx":0442
   ScaleHeight     =   3645
   ScaleWidth      =   5715
   Begin VB.CommandButton Command5 
      Caption         =   "下一条"
      Height          =   375
      Left            =   3240
      TabIndex        =   18
      Top             =   2280
      Width           =   1215
   End
   Begin VB.CommandButton Command4 
      Caption         =   "上一条"
      Height          =   375
      Left            =   3240
      TabIndex        =   17
      Top             =   1680
      Width           =   1215
   End
   Begin VB.CommandButton Command3 
      Caption         =   "添加新旅客"
      Height          =   375
      Left            =   3240
      TabIndex        =   16
      Top             =   2880
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   4680
      TabIndex        =   15
      Top             =   2640
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   4680
      TabIndex        =   14
      Top             =   1920
      Width           =   855
   End
   Begin VB.TextBox Text7 
      Height          =   375
      Left            =   3960
      TabIndex        =   13
      Top             =   840
      Width           =   1215
   End
   Begin VB.TextBox Text6 
      Height          =   375
      Left            =   3960
      TabIndex        =   11
      Top             =   120
      Width           =   1215
   End
   Begin VB.TextBox Text5 
      Height          =   375
      Left            =   1440
      TabIndex        =   9
      Top             =   3000
      Width           =   1335
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   1440
      TabIndex        =   7
      Top             =   2280
      Width           =   1335
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1440
      TabIndex        =   5
      Top             =   1560
      Width           =   1335
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   1440
      TabIndex        =   3
      Top             =   840
      Width           =   1335
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1440
      TabIndex        =   1
      Top             =   120
      Width           =   1335
   End
   Begin VB.Label Label7 
      BackStyle       =   0  'Transparent
      Caption         =   "籍贯:"
      Height          =   375
      Left            =   3360
      TabIndex        =   12
      Top             =   960
      Width           =   735
   End
   Begin VB.Label Label6 
      BackStyle       =   0  'Transparent
      Caption         =   "性别:"
      Height          =   375
      Left            =   3360
      TabIndex        =   10
      Top             =   240
      Width           =   735
   End
   Begin VB.Label Label5 
      Alignment       =   1  'Right Justify
      BackStyle       =   0  'Transparent
      Caption         =   "登记日期:"
      Height          =   375
      Left            =   240
      TabIndex        =   8
      Top             =   3120
      Width           =   1095
   End
   Begin VB.Label Label4 
      Alignment       =   1  'Right Justify
      BackStyle       =   0  'Transparent
      Caption         =   "房间号:"
      Height          =   375
      Left            =   240
      TabIndex        =   6
      Top             =   2400
      Width           =   1095
   End
   Begin VB.Label Label3 
      Alignment       =   1  'Right Justify
      BackStyle       =   0  'Transparent
      Caption         =   "身份证号码:"
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   1680
      Width           =   1095
   End
   Begin VB.Label Label2 
      Alignment       =   1  'Right Justify
      BackStyle       =   0  'Transparent
      Caption         =   "客人姓名:"
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   960
      Width           =   1095
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      BackStyle       =   0  'Transparent
      Caption         =   "登记号:"
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   1095
   End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public rs1 As ADODB.Recordset
Private Sub Command1_Click()
Command1.Enabled = False
Command3.Enabled = True

rs1(0) = Text1
rs1(1) = Text2
rs1(2) = Text3
rs1(3) = Text4
rs1(4) = Text5
rs1(5) = Text6
rs1(6) = Text7

rs1.Update

Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = Date
Text6 = ""
Text7 = ""

MsgBox "数据提交成功!", , "成功"
Call lj
Set rs1 = New ADODB.Recordset
rs1.Open "select * from 旅客信息表", conn
Set Form6.DataGrid1.DataSource = rs1
Form6.DataGrid1.Refresh
Unload Me

End Sub

Private Sub Command2_Click()
Unload Me

End Sub

Private Sub Command3_Click()
Command1.Visible = True
Command2.Visible = True
Command3.Enabled = False
Command1.Enabled = True




Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = Date
Text6 = ""
Text7 = ""

rs1.AddNew
Text1.SetFocus

End Sub

Private Sub Command4_Click()

rs1.MovePrevious
If rs1.BOF = True Then
  rs1.MoveFirst
  'Command1.Enabled = FalseText1 = Adodc1.Recordset(0)

End If
Text1 = rs1(0)
Text2 = rs1(1)
Text3 = rs1(2)
Text4 = rs1(3)
Text5 = rs1(4)
Text6 = rs1(5)
Text7 = rs1(6)

End Sub

Private Sub Command5_Click()

rs1.MoveNext
  If rs1.EOF = True Then
    rs1.MoveLast
   'Command2.Enabled = False
   End If
Text1 = rs1(0)
Text2 = rs1(1)
Text3 = rs1(2)
Text4 = rs1(3)
Text5 = rs1(4)
Text6 = rs1(5)
Text7 = rs1(6)
End Sub

Private Sub Form_Load()
Form4.Height = 4635
Form4.Width = 5835

Command1.Visible = False
Command2.Visible = False
Call lj
Set rs1 = New ADODB.Recordset
rs1.Open "select * from 旅客信息表", conn, adOpenKeyset, adLockOptimistic



Text1 = rs1(0)
Text2 = rs1(1)
Text3 = rs1(2)
Text4 = rs1(3)
Text5 = rs1(4)
Text6 = rs1(5)
Text7 = rs1(6)
End Sub

⌨️ 快捷键说明

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