1、自行车系统代码登录页面的代码Public a, b, c, d, e As StringPrivate Sub Command1_Click()a = Trim(Text1.Text)b = Trim(Text2.Text)c = Trim(Text3.Text)If a = Or b = Or c = Then MsgBox 请输入所要求的信息再登录!, vbOKCancel + 48, 登录ElseIf a = Then MsgBox 账号不能为空,请输入!, vbOKCancel + 48, 登录 Text1.SetFocusElseIf b = Then MsgBox 密码不能为空,请
2、输入!, vbOKCancel + 48, 登录 Text2.SetFocusElseIf c = Then MsgBox 请再次输一次密码!, vbOKCancel + 48, 登录 Text3.SetFocusElseIf a 农大111自行车 ThenMsgBox 账号错误!请确认输入, vbOKCancel + 48, 登录Text1.Text = Text1.SetFocusElseIf b fafu111 ThenMsgBox 密码错误!请确认输入, vbOKCancel + 48, 登录Text2.Text = Text2.SetFocusElseIf c b ThenMsgBo
3、x 密码不一致!请确认输入, vbOKCancel + 48, 登录Text2.Text = Text3.Text = Text2.SetFocusElseIf a = 农大111自行车 And b = fafu111 Then e = MsgBox(登录成功!, vbOKCancel + 64, 登陆成功) If e = vbOK Then Form1.Hide Form2.Show Else Text1.Text = Text2.Text = Text3.Text = End If End IfEnd SubPrivate Sub Command2_Click() EndEnd SubPr
4、ivate Sub Timer1_Timer()Label1.Left = Label1.Left + 20If Label1.Left Me.Width Then Label1.Left = 4440: Timer1.Enabled = FalseEnd Sub主窗体代码Private Sub cheliang1_Click()Form5.ShowEnd SubPrivate Sub cheliang2_Click()Form6.ShowEnd SubPrivate Sub chuzu_Click()Form4.ShowEnd SubPrivate Sub kehuguanli1_Click
5、()Form7.ShowEnd SubPrivate Sub tongji_Click()Form8.ShowEnd SubPrivate Sub xitong2_Click()Form3.ShowEnd SubPrivate Sub xitong3_Click()j = MsgBox(确定要退出吗?, vbOKCancel + 32, 警告)If j = vbOK Then EndEnd IfEnd Sub初始化窗体代码Private Sub Command1_Click()Select Case Combo1.ListIndexCase 0 If MsgBox(真的要进行初始化吗?, vb
6、YesNo, 确认初始化操作) = vbYes Then Call deldata(bike) Combo1.ListIndex = -1 Else Combo1.ListIndex = -1 End IfCase 1 If MsgBox(真的要进行初始化吗?, vbYesNo, 确认初始化操作) = vbYes Then Call deldata(users) Combo1.ListIndex = -1 Else Combo1.ListIndex = -1 End IfCase 2 If MsgBox(真的要进行初始化吗?, vbYesNo, 确认初始化操作) = vbYes Then Ca
7、ll deldata(book) Combo1.ListIndex = -1 Else Combo1.ListIndex = -1 End IfCase 3 If MsgBox(真的要进行系统初始化吗?, vbYesNo, 确认初始化操作) = vbYes Then Call deldata(bike) Call deldata(users) Call deldata(book) Combo1.ListIndex = -1 Else Combo1.ListIndex = -1 End IfEnd SelectEnd SubPrivate Sub Command2_Click()Form3.Hi
8、deEnd SubPrivate Sub Form_Load()End Sub出租处理代码Private Sub Command1_Click()Dim rs As ADODB.RecordsetIf Trim(Text1.Text) = Then MsgBox 请先输入客户编号! Command1.Enabled = TrueElse sql = select * from users where 客户编号= & & Trim(Text1.Text) & Set rs = exesql(sql) If rs.RecordCount = 0 Then MsgBox 没有该客户 Text1.Te
9、xt = Text1.SetFocus Exit Sub Else Adodc1.RecordSource = sql rs.Update Text1.Text = rs.Fields(客户编号).Value Text2.Text = rs.Fields().Value If rs.Fields(号).Value Then Text4.Text = rs.Fields(号).Value If rs.Fields(学生证号).Value Then Text4.Text = rs.Fields(学生证号).Value Text3.Text = rs.Fields(性别).Value Text5.T
10、ext = rs.Fields(手机).Value rs.Close Set rs = Nothing Set conn = Nothing End If End If Command1.Enabled = FalseEnd SubPrivate Sub Command10_Click() i = MsgBox(确认信息没有错了吗?, vbOKCancel + 32, 警告) If i = vbOK Then Command10.Enabled = False Else Command10.Enabled = True End IfEnd SubPrivate Sub Command11_Cl
11、ick()Frame4.Visible = FalseEnd SubPrivate Sub Command12_Click()Dim mey As StringIf Text14.Text Then mey = Str(Val(Text15.Text) * Val(Combo3.Text) + Val(Text14.Text)Else mey = Str(Val(Text15.Text) * Val(Combo3.Text)End If Text9.Text = Format(mey, #0.0) & 元 End Sub Private Sub Command13_Click()Dim rs
12、As ADODB.Recordset w = MsgBox(确定要删除吗?删除后不可恢复, vbOKCancel + 32, 警告) If w = vbOK Then If Trim(Text17.Text) Then sql = select * from book where 订单号= & & Trim(Text17.Text) & Set rs = exesql(sql) rs.Delete Adodc3.Refresh DataGrid1.Refresh MsgBox 删除成功 清空数据 Text17.Text = Text1.Text = Text2.Text = Text3.Tex
13、t = Text4.Text = Text5.Text = Text6.Text = Text7.Text = Text8.Text = Text9.Text = Text10.Text = Text11.Text = Text13.Text = Text14.Text = Text15.Text = rs.Close End If End IfEnd SubPrivate Sub Command14_Click()Text1.Text = Text2.Text = Text3.Text = Text4.Text = Text5.Text = Command1.Enabled = TrueEn
14、d SubPrivate Sub Command15_Click()Text6.Text = Text7.Text = Text8.Text = Command2.Enabled = TrueEnd SubPrivate Sub Command2_Click()Dim rs As ADODB.RecordsetIf Trim(Text6.Text) = Then MsgBox 请先输入车辆编号! Command2.Enabled = TrueElse sql = select * from bike where 车辆编号= & & Trim(Text6.Text) & Set rs = exe
15、sql(sql) If rs.RecordCount = 0 Then MsgBox 车库并没有该车辆 Text6.Text = Text6.SetFocus Exit Sub Else Adodc2.RecordSource = sql rs.Update Text7.Text = rs.Fields(车辆型号).Value Text8.Text = rs.Fields(颜色).Value rs.Close Set rs = Nothing Set conn = Nothing End If End If Command2.Enabled = FalseEnd SubPrivate Sub
16、Command3_Click() Text11.Text = Now()End SubPrivate Sub Command4_Click() Text13.Text = Now()End SubPrivate Sub Command5_Click()If Text11.Text And Combo3.Text Then Dim sql As String Dim rs As ADODB.Recordset Dim conn As New ADODB.Connection Set rs = New ADODB.Recordset Set conn = New ADODB.Connection
17、conn.ConnectionString = Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=bbu;Data Source= & GetName() conn.OpenIf Command1.Enabled False Or Command2.Enabled False Or Command10.Enabled False Then MsgBox 有表单信息漏填或忘了点击“确定” ElseIf Trim(Text17.Text) Then sql = select * from book
18、where 订单号= & & Trim(Text17.Text) & rs.Open sql, conn, 1, 1 If rs.RecordCount 0 Then 判断是否重复 MsgBox 该订单编号已存在!请重新填写 Text17.Text = Text17.SetFocus rs.Close Else rs.Close sql = select * from book rs.Open sql, conn, 3, 2 rs.AddNew rs.Fields(订单号).Value = Trim(Text17.Text) rs.Fields(客户编号).Value = Trim$(Text
19、1.Text) rs.Fields(证件号).Value = Trim(Text4.Text) rs.Fields().Value = Trim(Text2.Text) rs.Fields(性别).Value = Trim(Text3.Text) rs.Fields(手机).Value = Trim(Text5.Text) rs.Fields(车辆编号).Value = Trim(Text6.Text) rs.Fields(车辆型号).Value = Trim(Text7.Text) rs.Fields(颜色).Value = Trim(Text8.Text) rs.Fields(状态).Va
20、lue = 出租 rs.Fields(出租时间).Value = Trim(Text11.Text) If Combo3.Text Then rs.Fields(单价).Value = Trim(Combo3.Text) If Trim(Text10.Text) Then rs.Fields(押金).Value = Trim(Text10.Text) rs.Fields(是否已入库).Value = 否 rs.Update MsgBox 出租成功 清空数据 Adodc3.Refresh DataGrid1.Refresh rs.Close Set rs = NothingSet conn =
21、NothingCommand4.Enabled = TrueText15.Enabled = TrueText9.Enabled = TrueCombo1.Enabled = TrueText14.Enabled = TrueEnd IfEnd IfCommand1.Enabled = TrueCommand2.Enabled = TrueCommand10.Enabled = TrueElse MsgBox 出租时间和单价不能为空! Command10.Enabled = True Exit SubEnd IfEnd SubPrivate Sub Command6_Click()Frame4
22、.Visible = TrueEnd SubPrivate Sub Command7_Click() Dim rs As ADODB.Recordset If Trim(Text17.Text) Then sql = select * from book where 订单号= & & Trim(Text17.Text) & Set rs = exesql(sql) If rs.RecordCount = 0 Then MsgBox 并没有该订单,请确认 Text17.Text = Text17.SetFocus Exit Sub End If 以可写方式打开记录集 rs.Update If O
23、ption1.Value = True Then rs.Fields(状态).Value = 出租 Else rs.Fields(状态).Value = 归还 End If If Trim(Text13.Text) Then rs.Fields(归还时间).Value = Trim(Text13.Text) If Combo1.Text Then rs.Fields(是否损坏).Value = Combo1.Text If Combo4.Text Then rs.Fields(是否已入库).Value = Combo4.Text If Text4.Text Then rs.Fields(罚金)
24、.Value = Trim(Text14.Text) rs.Fields(出租款).Value = Text9.Text rs.Update Adodc3.Refresh DataGrid1.Refresh MsgBox 归还成功 清空数据 Text1.Text = Text2.Text = Text3.Text = Text4.Text = Text5.Text = Text6.Text = Text7.Text = Text8.Text = Text9.Text = Text10.Text = Text11.Text = Text13.Text = rs.Close End IfEnd S
25、ubPrivate Sub Command8_Click()If Trim(Text16.Text) ThenDim rs As ADODB.Recordset Select Case Combo2.ListIndex Dim sql As String Case 0 sql = select * from book where 订单号= & & Trim(Text16.Text) & Case 1 sql = select * from book where 客户编号= & & Trim(Text16.Text) & Case 2 sql = select * from book where
26、 车辆编号= & & Trim(Text16.Text) & End Select Set rs = exesql(sql) If rs.EOF = True Then MsgBox 不存在满足此条件的订单!,请确认 Text16.Text = Text16.SetFocus rs.Close Exit Sub Else rs.Update Adodc3.RecordSource = sql Adodc3.Refresh DataGrid1.Refresh rs.Close Set rs = Nothing Set conn = Nothing End If Else MsgBox 请先填写条
27、件 Exit Sub End IfEnd SubPrivate Sub Command9_Click()Combo2.Text = Text16.Text = End SubPrivate Sub DataGrid1_Click()Call DataGrid1_GotFocusEnd SubPrivate Sub DataGrid1_GotFocus() Dim rs As ADODB.Recordset If DataGrid1.Columns(订单号).Value Then Text17.Text = DataGrid1.Columns(订单号).Value If Trim(Text17.
28、Text) Then sql = select * from book where 订单号= & & Trim(Text17.Text) & Set rs = exesql(sql) rs.Update Adodc3.Refresh DataGrid1.Refresh Text1.Text = rs.Fields(客户编号).Value Text2.Text = rs.Fields().Value Text4.Text = rs.Fields(证件号).Value Text5.Text = rs.Fields(手机).Value If rs.Fields(性别).Value Then Text3.Text = rs.Fields(性别).Value Text7.Text = rs.Fields(车辆型号).Value If rs.Fields(押金).Value Then Text10.Text = rs.Fields(押金).Value Text6.Text = rs.Fields(车辆编号).Value
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1