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

📄 frminfo.frm

📁 一个适用于书店的图书管理信息系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
End Sub

Private Sub CmdDelete_Click()
Dim retMsg As Integer

On Error GoTo errEnd

If CmdNew.Caption = "确定" Then Exit Sub

retMsg = MsgBox("你确定要删除该留言吗?", vbYesNo + vbQuestion, "信息管理")
If retMsg = vbYes Then
    Adodc1.Recordset.Delete
    Call CmdNext_Click
End If
Exit Sub

errEnd:
    MsgBox Err.Description, vbOKOnly + vbExclamation, "数据库错误"
End Sub

Private Sub CmdFirst_Click()
Dim SexManValue As String

Adodc1.Recordset.MoveFirst
CmdUp.Enabled = False
CmdFirst.Enabled = False
CmdNext.Enabled = True
CmdLast.Enabled = True

SexManValue = Adodc1.Recordset!性别 & ""
TxtShenFen.Text = Adodc1.Recordset!身份 & ""
TxtName.Text = Adodc1.Recordset!姓名 & ""
TxtDanWei.Text = Adodc1.Recordset!单位 & ""
TxtDiZhi.Text = Adodc1.Recordset!地址 & ""
TxtEmail.Text = Adodc1.Recordset!电子邮件 & ""
TxtInfo.Text = Adodc1.Recordset!反馈信息 & ""

If SexManValue = "男" Then
    SexMan.Value = True
Else
    SexFemail.Value = True
End If

End Sub

Private Sub CmdLast_Click()
Dim SexManValue As String

Adodc1.Recordset.MoveLast
CmdNext.Enabled = False
CmdLast.Enabled = False
CmdUp.Enabled = True
CmdFirst.Enabled = True

SexManValue = Adodc1.Recordset!性别 & ""
TxtShenFen.Text = Adodc1.Recordset!身份 & ""
TxtName.Text = Adodc1.Recordset!姓名 & ""
TxtDanWei.Text = Adodc1.Recordset!单位 & ""
TxtDiZhi.Text = Adodc1.Recordset!地址 & ""
TxtEmail.Text = Adodc1.Recordset!电子邮件 & ""
TxtInfo.Text = Adodc1.Recordset!反馈信息 & ""

If SexManValue = "男" Then
    SexMan.Value = True
Else
    SexFemail.Value = True
End If

End Sub

Private Sub CmdNew_Click()
On Error GoTo errEnd

If CmdNew.Caption <> "确定" Then
    TxtName.Text = ""
    TxtDanWei.Text = ""
    TxtDiZhi.Text = ""
    TxtEmail.Text = ""
    TxtInfo.Text = ""
    TxtShenFen.Text = UserShenFen
    CmdNew.Caption = "确定"
    CmdFirst.Enabled = False
    CmdUp.Enabled = False
    CmdNext.Enabled = False
    CmdLast.Enabled = False
    CmdUpdate.Enabled = False
    CmdDelete.Enabled = False
    Exit Sub
End If

If TxtName.Text = "" Then
    MsgBox "请输入你的姓名!", vbOKOnly + vbExclamation, "信息反馈"
    TxtName.SetFocus
    Exit Sub
End If
If TxtDanWei.Text = "" Then
    TxtDanWei.Text = "未知"
End If
If TxtDiZhi.Text = "" Then
    TxtDiZhi.Text = "未知"
End If
If TxtEmail.Text = "" Then
    TxtEmail.Text = "未知"
End If
If TxtInfo.Text = "" Then
    MsgBox "请填写反馈信息!", vbOKOnly + vbExclamation, "信息反馈"
    TxtInfo.SetFocus
    Exit Sub
End If

Adodc1.Recordset.AddNew
Adodc1.Recordset!姓名 = TxtName.Text
Adodc1.Recordset!身份 = UserShenFen
If SexMan.Value Then
    Adodc1.Recordset!性别 = "男"
Else
    Adodc1.Recordset!性别 = "女"
End If
Adodc1.Recordset!单位 = TxtDanWei.Text
Adodc1.Recordset!地址 = TxtDiZhi.Text
Adodc1.Recordset!电子邮件 = TxtEmail.Text
Adodc1.Recordset!反馈信息 = TxtInfo.Text
Adodc1.Recordset!反馈日期 = Now
Adodc1.Recordset.Update

MsgBox "感谢你的意见或建议!", vbOKOnly + vbInformation, "信息反馈"
CmdNew.Caption = "添加"
CmdFirst.Enabled = True
CmdUp.Enabled = True
CmdNext.Enabled = True
CmdLast.Enabled = True
CmdUpdate.Enabled = True
CmdDelete.Enabled = True
Call CmdLast_Click

Exit Sub

errEnd:
    MsgBox Err.Description, vbOKOnly + vbExclamation, "数据库错误"
End Sub

Private Sub CmdNext_Click()
Dim SexManValue As String

If Adodc1.Recordset.EOF Then Exit Sub

Adodc1.Recordset.MoveNext

If Adodc1.Recordset.EOF Then
    Call CmdLast_Click
    Exit Sub
End If
CmdUp.Enabled = True
CmdFirst.Enabled = True

SexManValue = Adodc1.Recordset!性别 & ""
TxtShenFen.Text = Adodc1.Recordset!身份 & ""
TxtName.Text = Adodc1.Recordset!姓名 & ""
TxtDanWei.Text = Adodc1.Recordset!单位 & ""
TxtDiZhi.Text = Adodc1.Recordset!地址 & ""
TxtEmail.Text = Adodc1.Recordset!电子邮件 & ""
TxtInfo.Text = Adodc1.Recordset!反馈信息 & ""

If SexManValue = "男" Then
    SexMan.Value = True
Else
    SexFemail.Value = True
End If

End Sub

Private Sub CmdUp_Click()
Dim SexManValue As String

If Adodc1.Recordset.BOF Then Exit Sub

Adodc1.Recordset.MovePrevious

If Adodc1.Recordset.BOF Then
    Call CmdFirst_Click
    Exit Sub
End If
CmdNext.Enabled = True
CmdLast.Enabled = True

SexManValue = Adodc1.Recordset!性别 & ""
TxtShenFen.Text = Adodc1.Recordset!身份 & ""
TxtName.Text = Adodc1.Recordset!姓名 & ""
TxtDanWei.Text = Adodc1.Recordset!单位 & ""
TxtDiZhi.Text = Adodc1.Recordset!地址 & ""
TxtEmail.Text = Adodc1.Recordset!电子邮件 & ""
TxtInfo.Text = Adodc1.Recordset!反馈信息 & ""

If SexManValue = "男" Then
    SexMan.Value = True
Else
    SexFemail.Value = True
End If

End Sub

Private Sub CmdUpdate_Click()
On Error GoTo errEnd

If TxtName.Text = "" Then
    MsgBox "请输入你的姓名!", vbOKOnly + vbExclamation, "信息反馈"
    TxtName.SetFocus
    Exit Sub
End If
If TxtDanWei.Text = "" Then
    TxtDanWei.Text = "未知"
End If
If TxtDiZhi.Text = "" Then
    TxtDiZhi.Text = "未知"
End If
If TxtEmail.Text = "" Then
    TxtEmail.Text = "未知"
End If
If TxtInfo.Text = "" Then
    MsgBox "请填写反馈信息!", vbOKOnly + vbExclamation, "信息反馈"
    TxtInfo.SetFocus
    Exit Sub
End If

Adodc1.Recordset!姓名 = TxtName.Text
Adodc1.Recordset!身份 = UserShenFen
If SexMan.Value Then
    Adodc1.Recordset!性别 = "男"
Else
    Adodc1.Recordset!性别 = "女"
End If
Adodc1.Recordset!单位 = TxtDanWei.Text
Adodc1.Recordset!地址 = TxtDiZhi.Text
Adodc1.Recordset!电子邮件 = TxtEmail.Text
Adodc1.Recordset!反馈信息 = TxtInfo.Text
Adodc1.Recordset!反馈日期 = Now
Adodc1.Recordset.Update

MsgBox "当前记录修改成功!", vbOKOnly + vbInformation, "信息反馈"
Exit Sub

errEnd:
    MsgBox Err.Description, vbOKOnly + vbExclamation, "数据库错误"
End Sub

Private Sub Form_Activate()
If Adodc1.Recordset.RecordCount > 0 Then
    Call CmdFirst_Click
Else
    MsgBox "当前没有客户反馈信息!", vbOKOnly + vbInformation, "客户反馈"
    Call CmdNew_Click
End If
End Sub

Private Sub Form_Load()
Dim dbName As String
Dim connSTR As String

On Error GoTo errEnd

ChDir App.Path
dbName = App.Path
If Right(dbName, 1) <> "\" Then dbName = dbName + "\"
dbName = dbName + "DataBase\WFSSDataBase.mdb"

connSTR = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbName & ";Persist Security Info=False"
Adodc1.ConnectionString = connSTR

Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "客户反馈"
Adodc1.Refresh

Exit Sub

errEnd:
    MsgBox "连接数据库失败!", vbOKOnly + vbExclamation, "打开数据库出错"
    End
End Sub

⌨️ 快捷键说明

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