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

📄 frmaddper.frm

📁 用户MODBUS规约通信编程,起参考作用.
💻 FRM
字号:
VERSION 5.00
Object = "{D959C709-8613-11D1-9840-002078110E7D}#1.0#0"; "as97Popup.ocx"
Object = "{C7AE747C-B9E4-11D7-B0E3-D8165009166E}#7.0#0"; "XPForm.ocx"
Begin VB.Form frmpersonadd 
   BorderStyle     =   0  'None
   Caption         =   "添加人员信息"
   ClientHeight    =   5355
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   5040
   Icon            =   "frmaddper.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5355
   ScaleWidth      =   5040
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin XP窗体控件.XPForm XPForm1 
      Height          =   810
      Left            =   2160
      Top             =   2280
      Width           =   1920
      _ExtentX        =   3387
      _ExtentY        =   1429
      Caption         =   "添加人员信息"
      Icon            =   "frmaddper.frx":1272
      AlwaysOnTop     =   0   'False
      ShowFormSize    =   0   'False
   End
   Begin as97Popup.asPopup asPopup2 
      Height          =   495
      Left            =   3000
      Top             =   4560
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   873
      Caption         =   "取消"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BackColor       =   16744576
      ScaleWidth      =   89
      ScaleMode       =   0
      ScaleHeight     =   33
   End
   Begin as97Popup.asPopup asPopup1 
      Height          =   495
      Left            =   1080
      Top             =   4560
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   873
      Caption         =   "确定"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BackColor       =   16744576
      ScaleWidth      =   81
      ScaleMode       =   0
      ScaleHeight     =   33
   End
   Begin VB.TextBox Text5 
      Height          =   855
      Left            =   1320
      TabIndex        =   9
      Top             =   2640
      Width           =   3495
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   3240
      TabIndex        =   7
      Top             =   1800
      Width           =   1575
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   3240
      TabIndex        =   5
      Top             =   960
      Width           =   1575
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   1200
      TabIndex        =   3
      Top             =   1800
      Width           =   975
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1200
      TabIndex        =   1
      Top             =   960
      Width           =   975
   End
   Begin VB.Label Label5 
      BackColor       =   &H80000009&
      Caption         =   "备  注"
      Height          =   375
      Left            =   120
      TabIndex        =   8
      Top             =   2760
      Width           =   975
   End
   Begin VB.Label Label4 
      BackColor       =   &H80000009&
      Caption         =   "联系方式"
      Height          =   375
      Left            =   2280
      TabIndex        =   6
      Top             =   1800
      Width           =   855
   End
   Begin VB.Label Label3 
      BackColor       =   &H80000009&
      Caption         =   "住  址"
      Height          =   375
      Left            =   2280
      TabIndex        =   4
      Top             =   960
      Width           =   855
   End
   Begin VB.Label Label2 
      BackColor       =   &H80000009&
      Caption         =   "姓 名"
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   1800
      Width           =   975
   End
   Begin VB.Label Label1 
      BackColor       =   &H80000009&
      Caption         =   "编 号"
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   960
      Width           =   975
   End
End
Attribute VB_Name = "frmpersonadd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim txtsql As String
Dim connectstring As String

Private Sub asPopup1_Click(Cancel As Boolean)
On Error Resume Next

connectstring = "provider=Microsoft.Jet.oledb.4.0;" & _
            "data source=" & App.path & "\jk.mdb"
            conn.Open connectstring
Dim number, name, loc, find, st As String
Dim rs1 As New ADODB.Recordset
          
 number = Text1.Text
 name = Text2.Text
 loc = Text3.Text
 find = Text4.Text
 st = Text5.Text
 
If Len(Trim(Text1.Text)) = 0 Or Len(Trim(Text2.Text)) = 0 Or Len(Trim(Text3.Text)) = 0 Or Len(Trim(Text4.Text)) = 0 Or Len(Trim(Text5.Text)) = 0 Then
MsgBox "有未填内容"
Exit Sub
End If
txtsql = "select * from 人员信息表 where 编号='" & number & "'"
Set rs1 = conn.Execute(txtsql)
If rs1.EOF And rs1.BOF Then
txtsql = "insert into 人员信息表 values('" & number & "','" & name & "','" & loc & "','" & find & "','" & st & "')"
conn.Execute (txtsql)
Else
MsgBox "编号重复"
Text1.Text = ""
End If
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""



End Sub

Private Sub asPopup2_Click(Cancel As Boolean)
Unload Me

End Sub

Private Sub Form_Load()
XPForm1.Make
End Sub

⌨️ 快捷键说明

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