新人剛接觸,請大佬幫忙解惑,我底下If (floor = 2)的語句不執行,怎麼寫才能整個判斷執行,謝謝!
Private Sub show_gd_son8(PCBNO As String)Dim Rs As New ADODB.Recordset
Dim strSql As String
strSql = " select SUBSTRING(PcbNo,6,1) as floor ,PlatLength/25.4 as PlatLength,PlatWidth/25.4 as PlatWidth " & _
" from cyerp.dbo.tblEng_WorkDirection_Plating " & _
" where SH_Status=1 and PcbNo='" & Trim(PCBNO) & "' "
If Rs.State = adStateOpen Then Rs.Close
With Rs
.Source = strSql
.Open , gConnection, adOpenStatic, adLockReadOnly, 1
End With
If Rs.EOF Then
Exit Sub
End If
floor = Rs.Fields("floor").Value
PlatLength = Rs.Fields("PlatLength").Value
PlatWidth = Rs.Fields("PlatWidth").Value
If floor > 2 Then
strSql = " select YaheWLen as WLen,YaheJLen as JLen from cyerp.dbo.tblEng_WorkDirection_PressMerge " & _
" where SH_Status=1 and PcbNo='" & Trim(PCBNO) & "' "
End If
If Rs.State = adStateOpen Then Rs.Close
With Rs
.Source = strSql
.Open , gConnection, adOpenStatic, adLockReadOnly, 1
End With
If Rs.EOF Then
Exit Sub
End If
WLen = Rs.Fields("WLen").Value
JLen = Rs.Fields("JLen").Value
If (PlatLength <> WLen) Or (PlatWidth <> JLen) Then
MsgBox "多層板壓合撈邊尺寸有誤", vbOKOnly, "警告"
End If
If (floor = 2) Then
strSql = " select cutlengthIn,cutwidthIn from cyerp.dbo.tblEng_WorkDirection_Cutter " & _
" where SH_Status=1 and PcbNo='" & Trim(PCBNO) & "' "
End If
If Rs.State = adStateOpen Then Rs.Close
With Rs
.Source = strSql
.Open , gConnection, adOpenStatic, adLockReadOnly, 1
End With
If Rs.EOF Then
Exit Sub
End If
cutlengthIn = Rs.Fields("cutlengthIn").Value
cutwidthIn = Rs.Fields("cutwidthIn").Value
If (PlatLength<> cutlengthIn) Or (PlatWidth<> cutwidthIn) Then
MsgBox "雙層板開料尺寸有誤", vbOKOnly, "警告"
End If
[此贴子已经被作者于2020-11-20 18:25编辑过]