| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1853 人关注过本帖
标题:新人剛接觸,請大佬幫忙解惑,我底下If (floor = 2)的語句不執行,怎麼寫才 ...
取消只看楼主 加入收藏
tianxia978
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2020-11-19
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:4 
新人剛接觸,請大佬幫忙解惑,我底下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编辑过]

搜索更多相关主题的帖子: Fields Value Then End If 
2020-11-20 18:22
tianxia978
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2020-11-19
收藏
得分:0 
回复 2楼 cwa9958
上面floor>2的可以拿到,並且能夠執行,從floor=2 開始就出問題了,難道我得從寫一個floor=2的方法?我想寫在一個方法里分別判斷執行的,
2020-11-21 08:50
tianxia978
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2020-11-19
收藏
得分:0 
回复 4楼 cwa9958
多謝大哥,你的代碼幫我去掉了end if 之後現在都能根據條件執行了,滿足了我的需求。
在幫我看看這個圖片   
图片附件: 游客没有浏览图片的权限,请 登录注册
  的問題能弄好嗎,執行時提示automation 錯誤,找不到知道你個模組。
2020-11-21 13:49
tianxia978
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2020-11-19
收藏
得分:0 
回复 5楼 ZHRXJR
謝謝幫我分析阿。
2020-11-21 13:51
tianxia978
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2020-11-19
收藏
得分:0 
回复 8楼 cwa9958
原本這個程式在別的電腦上點擊預覽會調出EXCEL都正常,不會報錯,我電腦沒安裝VB,安裝之後把那個程式拷到我電腦上運行點擊預覽就報automation錯誤,找不到指定模組,也不知道是沒配置好還是沒有引用什麽插件,還是電腦缺失文件,反正已經重裝了軟件4次了。網上搜了一下regsvr32 MSINET.OCX註冊,也不起作用。
2020-11-21 15:39
快速回复:新人剛接觸,請大佬幫忙解惑,我底下If (floor = 2)的語句不執行,怎麼 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016946 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved