Office中国论坛/Access中国论坛

标题: help帮改下这段代码! [打印本页]

作者: dasen    时间: 2004-8-9 16:32
标题: help帮改下这段代码!
        If Left([Style], 3) = "uba" Then

            If Dir("\\sm-server\g\our photo\smartrend\bangle\" & Me.Style & ".jpg ") = "" Then

                If Dir("\\sm-server\g\our photo\wax-silver model\新款号-photo\" & Me.Style & ".jpg") <> "" Then

                    image.picture = "\\sm-server\g\our photo\wax-silver model\新款号-photo\" & Me.Style & ".jpg"

                Else

                    image.picture = ""

                End If

            Else

                image.picture = "\\sm-server\g\our photo\smartrend\bangle\" & Me.Style & ".jpg"

            End If

        ElseIf Left([Style], 2) = "ub" Then '尝试采用模糊方法打开图片

            If Dir("\\sm-server\g\our photo\smartrend\bracelet\" & Me.Style & "*.jpg ") = "" Then

                If Dir("\\sm-server\g\our photo\wax-silver model\新款号-photo\" & Me.Style & "*.jpg") <> "" Then

                    image.picture = Dir("\\sm-server\g\our photo\wax-silver model\新款号-photo\" & Me.Style & "*.jpg")

                    '这句赋值语句有问题 ,可否帮改下

                    '运行时显未:错误2220,不能打开文件ub0032e.jpg

                Else

                    image.picture = ""

                End If

            Else

                image.picture = Dir("\\sm-server\g\our photo\smartrend\bracelet\" & Me.Style & "*.jpg ")

            End If

        End If
作者: dasen    时间: 2004-8-10 00:37
标题: help帮改下这段代码!
问题解决了! Me.image.picture = ""

    Dim myfile, mypath1, mypath2, mypath3 As String

   

    mypath1 = "\\sm-server\g\our photo\smartrend\"

    mypath2 = "\\sm-server\g\our photo\wax-silver model\新款号-photo\"

    mypath3 = "\\sm-server\g\our photo\smartrend\ring\"

   

        If Left([Style], 3) = "uba" Then

            If Dir(mypath1 & "bangle\" & Me.Style & "*.jpg ") = "" Then '尝试采用模糊方法打开图片

                If Dir(mypath2 & Me.Style & "*.jpg") <> "" Then

                    myfile = Dir(mypath2 & Me.Style & "*.jpg")

                    image.picture = mypath2 & myfile

                Else

                    image.picture = ""

                End If

            Else

                myfile = Dir(mypath1 & "bangle\" & Me.Style & "*.jpg ")

                image.picture = mypath1 & "bangle\" & myfile

            End If

        ElseIf Left([Style], 2) = "ub" Then

            If Dir(mypath1 & "bracelet\" & Me.Style & "*.jpg ") = "" Then

                If Dir(mypath2 & Me.Style & "*.jpg") <> "" Then

                    myfile = Dir(mypath2 & Me.Style & "*.jpg")

                    image.picture = mypath2 & myfile

                Else

                    image.picture = ""

                End If

            Else

                myfile = Dir(mypath1 & "bracelet\" & Me.Style & "*.jpg ")

                image.picture = mypath1 & "bracelet\" & myfile

            End If    end if




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3