VB宾馆管理系统 第8页

VB宾馆管理系统 第8页
Private Sub Form_Load()
    Dim sSql As String
    Dim intCount As Integer
    Dim MsgText As String
   
   
    If flagSedit Then
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        If Not mrc.EOF Then
            For intCount = 0 To 3
                cboItem(intCount).AddItem mrc.Fields(intCount)
                cboItem(intCount).ListIndex = 0
            Next intCount
            txtItem(5) = mrc.Fields(5)
        End If
        mrc.Close
        txtNo = GetRkno()
        gintBmode = 1
       
    Else
        If gintBmode = 1 Then
            Me.Caption = Me.Caption & "添加"
       
        '初始化客房信息
            txtSQL = "select DISTINCT roomNO from rooms where putup <> 'y'"
            Set mrc = ExecuteSQL(txtSQL, MsgText)
       
            If Not mrc.EOF Then
               
                    Do While Not mrc.EOF
                        cboItem(0).AddItem Trim(mrc.Fields(0))
                        mrc.MoveNext
                    Loop
            Else
                MsgBox "请先进行客房登记!", vbOKOnly + vbExclamation, "警告"
                cmdSave.Enabled = False
                Exit Sub
            End If
            mrc.Close
       
            txtNo = GetRkno
               
        ElseIf gintBmode = 2 Then
      
       
       
                    Set mrc = ExecuteSQL(txtSQL, MsgText)
       
                    If mrc.EOF = False Then
                        With mrc
                            txtNo = !bookno
                           
                            For intCount = 0 To 1
                                If Not IsNull(.Fields(intCount + 1)) Then
                                    txtItem(intCount) = .Fields(intCount + 1)
                                End If
                            Next intCount
                           
                            cboItem(0).AddItem !roomno
                            cboItem(0).ListIndex = 0
                           
                            For intCount = 2 To 4
                                If Not IsNull(.Fields(intCount + 2)) Then
                                    txtItem(intCount) = .Fields(intCount + 2)
                                End If
                            Next intCount
                           
                        End With
                   
                    End If
                    mrc.Close
                    Me.Caption = Me.Caption & "修改"
                   
                    txtSQL = "select * from rooms where roomNO = '" & Trim(cboItem(0)) & "'"
                    Set mrc = ExecuteSQL(txtSQL, MsgText)
                    If Not mrc.EOF Then
                        For intCount = 1 To 3
                            cboItem(intCount).AddItem mrc.Fields(intCount)
                            cboItem(intCount).ListIndex = 0
                        Next intCount
                        txtItem(5) = mrc.Fields(5)
                    End If
                   
                    mrc.Close
 
               
        End If
    End If
   
        mblChange = False
   
   
End Sub

Private Sub Form_Unload(Cancel As Integer)
    gintBmode = 0
End Sub

 

 

Private Sub txtItem_Change(Index As Integer)
    '有变化设置gblchange
    mblChange = True
   
End Sub

Private Sub txtItem_GotFocus(Index As Integer)
    txtItem(Index).SelStart = 0
    txtItem(Index).SelLength = Len(txtItem(Index))
   
End Sub

Private Sub txtItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
        EnterToTab KeyCode

End Sub
2:订房信息查询窗体源代码:
Option Explicit
'用于传递查询块

 

Private Sub chkItem_Click(Index As Integer)
    If Index = 2 Then
        cboYear(0).SetFocus
    Else
        txtItem(Index).SetFocus
    End If
End Sub

Private Sub cmdExit_Click()
    Me.Hide
End Sub

Private Sub cmdOK_Click()

    Dim dBeginDate As String
    Dim sQSql As String
   
    If chkItem(0).Value = vbChecked Then
        sQSql = " customname = '" & Trim(txtItem(0) & " ") & "'"
    End If
   
    If chkItem(1).Value = vbChecked Then
        If Trim(sQSql & " ") = "" Then
            sQSql = " roomno ='" & Trim(txtItem(1) & " ") & "'"
        Else
            sQSql = sQSql & " and roomno ='" & Trim(txtItem(1) & " ") & "'"
        End If
    End If
   
    If chkItem(2).Value = vbChecked Then
        dBeginDate = Format(CDate(cboYear(0) & "-" & cboMonth(0) & "-" & cboDay), "yyyy-mm-dd")
       
       
        If Trim(sQSql & " ") = "" Then
            sQSql = " indate ='" & dBeginDate & "'"
        Else
            sQSql = sQSql & " and indate ='" & dBeginDate & "'"
        End If
       
   
    End If
   
    If Trim(sQSql) = "" Then
        MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    Else
        If flagBedit Then
            Unload frmBookin
        End If
        frmBookin.txtSQL = "select bookno,customname,customID,roomno,indate,discount,inmemo from

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页

  • 上一篇文章:
  • 下一篇文章:
  • Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有