源代码清单

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

附录:主要窗体的源代码:1:订房信息窗体的源代码:OptionExplicit'是否改动过记录,ture为改过DimmblChangeAsBooleanDimmrcAsADODB.RecordsetPublictxtSQLAsStringPrivateSubcboItem_Change(IndexAsInteger)'有变化设置gblchangemblChange=TrueEndSubPrivateSubcboItem_Click(IndexAsInteger)DimmrccAsADODB.RecordsetDimintCountAsIntegerDimMsgTextAsStringIfgintBmode=1ThenIfIndex=0ThentxtSQL=select*fromroomswhereroomNO='&Trim(cboItem(0))&'andputup'是'Setmrcc=ExecuteSQL(txtSQL,MsgText)ForintCount=1To3cboItem(intCount).ClearcboItem(intCount).AddItemmrcc.Fields(intCount)cboItem(intCount).ListIndex=0NextintCounttxtItem(5)=mrcc.Fields(5)mrcc.CloseEndIfEndIfEndSubPrivateSubcboItem_KeyDown(IndexAsInteger,KeyCodeAsInteger,ShiftAsInteger)EnterToTabKeyCodeEndSubPrivateSubcmdExit_Click()IfmblChangeAndcmdSave.EnabledThenIfMsgBox(保存当前记录的变化吗?,vbOKCancel+vbExclamation,警告)=vbOKThen'保存CallcmdSave_ClickEndIfEndIfUnloadMeEndSubPrivateSubcmdSave_Click()DimintCountAsIntegerDimsMegAsStringDimmrccAsADODB.RecordsetDimMsgTextAsStringForintCount=0To3IfTrim(txtItem(intCount)&)=ThenSelectCaseintCountCase0sMeg=顾客姓名Case1sMeg=身份证号码Case2sMeg=折扣Case3sMeg=入住时间EndSelectsMeg=sMeg&不能为空!MsgBoxsMeg,vbOKOnly+vbExclamation,警告txtItem(intCount).SetFocusExitSubEndIfNextintCountForintCount=0To3IfTrim(cboItem(intCount)&)=ThenSelectCaseintCountCase0sMeg=客房编号Case1sMeg=客房种类Case2sMeg=客房位置Case3sMeg=客房单价EndSelectsMeg=sMeg&不能为空!MsgBoxsMeg,vbOKOnly+vbExclamation,警告cboItem(intCount).SetFocusExitSubEndIfNextintCountIfIsDate(txtItem(2))ThentxtItem(2)=Format(txtItem(2),yyyy-mm-dd)ElseMsgBox入库时间应输入日期(yyyy-mm-dd)!,vbOKOnly+vbExclamation,警告txtItem(2).SetFocusExitSubEndIfForintCount=1To3Step2IfNotIsNumeric(txtItem(intCount))ThenMsgBox请输入数字,vbOKOnly+vbExclamation,警告txtItem(intCount).SetFocusExitSubEndIfNextintCountIfgintBmode=2ThentxtSQL=deletefrombookinwherebookno='&Trim(txtNo)&'Setmrcc=ExecuteSQL(txtSQL,MsgText)EndIftxtSQL=select*frombookinSetmrcc=ExecuteSQL(txtSQL,MsgText)mrcc.AddNewmrcc.Fields(0)=txtNoForintCount=0To1mrcc.Fields(intCount+1)=txtItem(intCount)NextintCountmrcc.Fields(3)=cboItem(0)ForintCount=2To4mrcc.Fields(intCount+2)=txtItem(intCount)NextintCountmrcc.Fields(8)=0mrcc.Updatemrcc.ClosetxtSQL=select*fromroomswhereroomNO='&Trim(cboItem(0))&'Setmrcc=ExecuteSQL(txtSQL,MsgText)IfNotmrcc.EOFThenmrcc!putup=yEndIfmrcc.Updatemrcc.CloseIfgintBmode=1ThenMsgBox添加订房信息成功!,vbOKOnly+vbExclamation,添加订房消息UnloadMeIfflagBeditThenUnloadfrmBookinEndIffrmBookin.txtSQL=selectbookno,customname,customID,roomno,indate,discount,inmemofrombookinwhereammount='0'frmBookin.ShowElseMsgBox修改订房信息成功!,vbOKOnly+vbExclamation,修改订房消息UnloadMeIfflagBeditThenUnloadfrmBookinEndIffrmBookin.txtSQL=selectbookno,customname,customID,roomno,indate,discount,inmemofrombookinwhereammount='0'frmBookin.ShowEndIfEndSubPrivateSubForm_Load()DimsSqlAsStringDimintCountAsIntegerDimMsgTextAsStringIfflagSeditThenSetmrc=ExecuteSQL(txtSQL,MsgText)IfNotmrc.EOFThenForintCount=0To3cboItem(intCount).AddItemmrc.Fields(intCount)cboItem(intCount).ListIndex=0NextintCounttxtItem(5)=mrc.Fields(5)EndIfmrc.ClosetxtNo=GetRkno()gintBmode=1ElseIfgintBmode=1ThenMe.Caption=Me.Caption&添加'初始化客房信息txtSQL=selectDISTINCTroomNOfromroomswhereputup'y'Setmrc=ExecuteSQL(txtSQL,MsgText)IfNotmrc.EOFThenDoWhileNotmrc.EOFcboItem(0).AddItemTrim(mrc.Fields(0))mrc.MoveNextLoopElseMsgBox请先进行客房登记!,vbOKOnly+vbExclamation,警告cmdSave.Enabled=FalseExitSubEndIfmrc.ClosetxtNo=GetRknoElseIfgintBmode=2ThenSetmrc=ExecuteSQL(txtSQL,MsgText)Ifmrc.EOF=FalseThenWithmrctxtNo=!booknoForintCount=0To1IfNotIsNull(.Fields(intCount+1))ThentxtItem(intCount)=.Fields(intCount+1)EndIfNextintCountcboItem(0).AddItem!roomnocboItem(0).ListIndex=0ForintCount=2To4IfNotIsNull(.Fields(intCount+2))ThentxtItem(intCount)=.Fields(intCount+2)EndIfNextintCountEndWithEndIfmrc.CloseMe.Caption=Me.Caption&修改txtSQL=select*fromroomswhereroomNO='&Trim(cboItem(0))&'Setmrc=ExecuteSQL(txtSQL,MsgText)IfNotmrc.EOFThenForintCount=1To3cboItem(intCount).AddItemmrc.Fields(intCount)cboItem(intCount).ListIndex=0NextintCounttxtItem(5)=mrc.Fields(5)EndIfmrc.CloseEndIfEndIfmblChange=FalseEndSubPrivateSubForm_Unload(CancelAsInteger)gintBmode=0EndSubPrivateSubtxtItem_Change(IndexAsInteger)'有变化设置gblchangemblChange=TrueEndSubPrivateSubtxtItem_GotFocus(IndexAsInteger)txtItem(Index).SelStart=0txtItem(Index).SelLength=Len(txtItem(Index))EndSubPrivateSubtxtItem_KeyDown(IndexAsInteger,KeyCodeAsInteger,ShiftAsInteger)EnterToTabKeyCodeEndSub2:订房信息查询窗体源代码:OptionExplicit'用于传递查询块PrivateSubchkItem_Click(IndexAsInteger)IfIndex=2ThencboYear(0).SetFocusElsetxtItem(Index).SetFocusEndIfEndSubPrivateSubcmdExit_Click()Me.HideEndSubPrivateSubcmdOK_Click()DimdBeginDateAsStringDimsQSqlAsStringIfchkItem(0).Value=vbCheckedThensQSql=customname='&Trim(txtItem(0)&)&'EndIfIfchkItem(1).Value=vbCheckedThenIfTrim(sQSql&)=ThensQSql=roomno='&Trim(txtItem(1)&)&'ElsesQSql=sQSql&androomno='&Trim(txtItem(1)&)&'EndIfEndIfIfchkItem(2).Value=vbCheckedThendBeginDate=Format(CDate(cboYear(0)&-&cboMonth(0)&-&cboDay),yyyy-mm-dd)IfTrim(sQSql&)=ThensQSql=indate='&dBeginDate&'ElsesQSql=sQSql&andindate='&dBeginDate&'EndI

1 / 38
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功