|
从日本得来的一个量具管理系统,由于乱码已经转换。但还是有问题,由于本人不懂VBA,还请大神们帮忙看看 代码哪里错误。
问题:进行量具的校正有效期限筛选时,还未到有效期限的10月,11月,12月被筛选为已过有效期限。1~9月份正常。
下面复制几段代码,请先判断一下,如果不能找到原因将上传附件(附件里也有很多日语部分说明)
'機能 :台帳詳細を台帳フォームに表示する
'引数 :
'戻り値 :
'**********************************************************
Public Sub ShowMeasDetails()
Const PROC_NAME As String = "clsMeasDetails/ShowMeasDetails"
On Error GoTo MyErr
With frmLed
.cboCat.Text = mCat
.cboGroup.Text = mGroup
.cboProductName.Text = mProductName
.txtUsage.Text = mUsage
.txtCreationDate.Text = FORMAT(mCreationDate, "yyyy/m/d")
.txtRefeNo.Text = mRefeNo
.txtUniqueNo1.Text = mUniqueNo1
.txtUniqueNo2.Text = mUniqueNo2
.cboManaClass.Text = mManaClass
.txtCalCycle.Text = mCalCycle
.txtExpDateYear.Text = FORMAT(mExpDate, "yyyy")
.txtExpDateMonth.Text = FORMAT(mExpDate, "m")
'有効期限残月表示
Call ShowExpDateTimeLimit
.txtRemarks.Text = mRemarks
.txtMaker.Text = mMaker
.txtModel.Text = mModel
.txtScaleInterVal.Text = mScaleInterval
.txtMeas.Text = mMeas
.txtOthersSpec.Text = mOthersSpec
Call basFrmLed.ShowRefeSign
Call basFrmLed.ShowStandardCalCycle
End With
Exit Sub
Public Sub ShowExpDateTimeLimit()
With frmLed
If .txtExpDateYear.Text <> "" And .txtExpDateMonth.Text <> "" And _
.lblExpDateErr.Visible = False Then
Dim cColor As clsColor
Set cColor = New clsColor
.txtTimeLimit.Text = _
DateDiff("m", Date, DateSerial(.txtExpDateYear.Text, .txtExpDateMonth.Text, 1))
If .txtTimeLimit.Text >= 0 Then
.txtTimeLimit.ForeColor = cColor.black
Else
.txtTimeLimit.ForeColor = cColor.red
End If
End If
End With
End Sub
'**********************************************************
'機能 :台帳フォームをクリップボードに登録する
'引数 :
'戻り値 :
'**********************************************************
Public Sub RegisterFrmLedInClipBoard()
Const PROC_NAME As String = "basFrmLedClipBoard/RegisterFrmLedInClipBoard"
On Error GoTo MyErr
Dim myWs As Worksheet 'クリップボードシート
Dim myClm As Long 'クリップボードシート列
Dim myExpDate As String '有効期限
Set myWs = VBAProject.wsclipBoard
myClm = GetWsClipBoardClm
Call ClearClipBoard
With frmLed
myWs.Cells(WsClipRow.WsClipRow_CopyDate, myClm).Value = Date & " " & Time
myWs.Cells(WsClipRow.WsClipRow_RefeNo, myClm).Value = .txtRefeNo.Text
myWs.Cells(WsClipRow.WsClipRow_UniqueNo1, myClm).Value = .txtUniqueNo1.Text
myWs.Cells(WsClipRow.WsClipRow_UniqueNo2, myClm).Value = .txtUniqueNo2.Text
myWs.Cells(WsClipRow.WsClipRow_Cat, myClm).Value = .cboCat.Text
myWs.Cells(WsClipRow.WsClipRow_Group, myClm).Value = .cboGroup.Text
myWs.Cells(WsClipRow.WsClipRow_ProductName, myClm).Value = .cboProductName.Text
myWs.Cells(WsClipRow.WsClipRow_Usage, myClm).Value = .txtUsage.Text
myWs.Cells(WsClipRow.WsClipRow_Remarks, myClm).Value = .txtRemarks.Text
myWs.Cells(WsClipRow.WsClipRow_ManaClass, myClm).Value = .cboManaClass.Text
myWs.Cells(WsClipRow.WsClipRow_CalCycle, myClm).Value = .txtCalCycle.Text
myExpDate = .txtExpDateYear.Text & "/" & .txtExpDateMonth.Text & "/1"
If IsDate(myExpDate) = True Then
myWs.Cells(WsClipRow.WsClipRow_ExpDate, myClm).Value = FORMAT(myExpDate, "yyyy/m")
Else
myWs.Cells(WsClipRow.WsClipRow_ExpDate, myClm).Value = .txtExpDateYear.Text & _
.txtExpDateMonth.Text
End If
myWs.Cells(WsClipRow.WsClipRow_Maker, myClm).Value = .txtMaker.Text
myWs.Cells(WsClipRow.WsClipRow_Model, myClm).Value = .txtModel.Text
myWs.Cells(WsClipRow.WsClipRow_ScaleInterval, myClm).Value = .txtScaleInterVal.Text
myWs.Cells(WsClipRow.WsClipRow_Meas, myClm).Value = .txtMeas
myWs.Cells(WsClipRow.WsClipRow_OthersSpec, myClm).Value = .txtOthersSpec.Text
End With
GoSub Finally
Exit Sub
'機能 :有効期限(年月)形式に設定する
'引数 :settingRng-設定範囲
'戻り値 :
'**********************************************************
Public Sub SetYYYYMType(ByVal settingRng As Range)
Const YYYY_M_FORMAT As String = "yyyy.m" '有効期限
settingRng.NumberFormatLocal = YYYY_M_FORMAT
End Sub
|
|