物流运输管理系统 第7页
4.6 新增客户表单
新建FRMCLIENTADD表单,用来新增加物流系统的客户管理,在该表单中,可以输入客户的各种信息,包括姓名、性别、工作单位、联系电话、手机号码、传真、联系地址和备注等信息。
代码如下:
Private Sub Form_Load()
Me.Top = 0
Me.Left = 0
Me.Width = MainForm.Width * 0.54
Me.Height = MainForm.Height * 0.54
'取得最大ID
Dim inum As Integer
Dim strsql As String
Dim DB As New clsDataBase
Dim rs As New ADODB.Recordset
strsql = "SELECT MAX(ID) AS MAXID FROM CLIENT"
Set rs = sys.DB.OpenRecordSet(strsql)
If Not IsNull(rs(0)) Then
ID = rs(0) + 1
Else
ID = 0
End If
txtID.Text = ID
'初始化性别
cmbSex.AddItem (" 男")
cmbSex.ItemData(0) = 0
cmbSex.AddItem (" 女")
cmbSex.ItemData(1) = 1
cmbSex.ListIndex = 0
End Sub
'检查表单数据
Private Function CheckForm() As Boolean
CheckForm = False
If txtName.Text = "" Then
MsgBox "姓名不能为空!"
txtCarNum.SetFocus
Else
CheckForm = True
End If
End Function
4.7 查看客户表单
新建FRMCLIENT表单,用来查看、修改和删除客户信息,在该表单中,通过各个功能按钮,完成对客户信息的查询、修改和删除等操作。在下面的列表中可以方便的查看客户的各种信息。
查看客户窗体的控件及属性取值如下:
控件 属性 属性取值
Label Name lblTitle
Caption 查看客户
commandbutton Name cmdadd
Caption 新增
Name cmdmodify
Caption 修改
Name cmddelete
Caption 删除
代码如下:
Private Sub Form_Load()
Me.Top = 0
Me.Left = 0
Me.Width = MainForm.Width * 0.7
Me.Height = MainForm.Height * 0.65
Call query
End Sub
Public Sub query(Optional ByVal strsql As String = "SELECT * FROM CLIENT ORDER BY ID DESC")
'查询客户
Dim inum As Integer
Dim rs As New ADODB.Recordset
ReDim arrclient(6, 0)
Dim total As Integer
total = 0
'清除原有
lsvClient.ListItems.Clear
With lsvClient
lsvClient.ColumnHeaders.Clear
.ColumnHeaders.Add , , "序号", 600
.ColumnHeaders.Add , , "姓名", 1200
.ColumnHeaders.Add , , "性别", 1200
.ColumnHeaders.Add , , "公司名称", 1600
.ColumnHeaders.Add , , "联系电话", 1600
.ColumnHeaders.Add , , "手机号码", 1600
.ColumnHeaders.Add , , "备注", 2000
.GridLines = True
.ColumnHeaders.Item(1).Alignment = lvwColumnLeft
.ColumnHeaders.Item(2).Alignment = lvwColumnCenter
.ColumnHeaders.Item(2).Alignment = lvwColumnCenter
.ColumnHeaders.Item(3).Alignment = lvwColumnCenter
.ColumnHeaders.Item(4).Alignment = lvwColumnCenter
.ColumnHeaders.Item(5).Alignment = lvwColumnCenter
.ColumnHeaders.Item(6).Alignment = lvwColumnCenter
.ColumnHeaders.Item(6).Alignment = lvwColumnCenter
End With
Set rs = sys.DB.OpenRecordSet(strsql)
If Not (rs.BOF) Or (rs.EOF) Then
'取出记录集
inum = 0
Do While Not rs.EOF
ReDim Preserve arrclient(6, inum)
arrclient(0, inum) = rs.Fields("ID")
arrclient(1, inum) = rs.Fields("NAME")
If sys.TextTolong(rs.Fields("SEX")) = 0 Then
arrclient(2, inum) = "男"
Else
arrclient(2, inum) = "女"
End If
arrclient(3, inum) = rs.Fields("COMPANY")
arrclient(4, inum) = rs.Fields("TELEPHONE")
arrclient(5, inum) = rs.Fields("MOBILE")
arrclient(6, inum) = rs.Fields("REMARK")
inum = inum + 1
rs.MoveNext
Loop
total = rs.RecordCount
End If
Dim iq As Integer
Dim ia As Integer
For iq = 0 To UBound(arrclient, 2)
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页
物流运输管理系统 第7页下载如图片无法显示或论文不完整,请联系qq752018766