Access交流中心

北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |

[5分]上传、下载、打开文件到指定文件夹

陈琳  发表于:2013-08-20 17:53:24  
复制

老师,我参考的例子是:http://www.accessoft.com/article-show.asp?id=6618

我上传文件,会弹出这个提示:

我是单机版的。

原来是可以可以成功上传的,后来就不行了。

5号老师说问题出在以下**的地方。我反复看例子,也没发现有代码漏掉了。

我想上传软件但是大于2M上传不了。。。。可以QQ传给你们吗?


Private Sub Upload_Click()
    On Error GoTo Err_cmdPhoto_Click
    Dim fso As Object
    Dim s_filepath, strFileName, s_fileName, s_fullname, s_newFile, ServerPath As String


    ServerPath = g_Server & "\NDA\"
 
    With Application.FileDialog(3)
        .Filters.Clear
        .Filters.Add "(*.*)All Files", "*.*"
        If .Show Then strFileName = .SelectedItems(1)
    End With
    If Not IsNull(strFileName) And Len(strFileName) > 0 Then
        s_fileName = ServerPath & Mid(strFileName, InStrRev(strFileName, "\") + 1)
       
        MsgBox "Files has been upload to:" & s_fileName
        s_fullname = Mid(strFileName, InStrRev(strFileName, "\") + 1)
        s_newFile = "Copy of_" & s_fullname
        Set fso = CreateObject("Scripting.FileSystemObject")
        If fso.FileExists(s_fileName) = True Then
            If MsgBox("File exists,overwrite it? Or change the name and upload again", vbOKCancel + vbInformation, "ìáê¾") = vbOK Then
                FileCopy strFileName, s_fileName
                Me.fj = s_fullname
            Else
                Exit Sub
            End If
        Else
            FileCopy strFileName, s_fileName
            Me.fj = s_fullname
        End If
        Set fso = Nothing
    End If


Exit_cmdPhoto_Click:

    Exit Sub

Err_cmdPhoto_Click:
    MsgBox "#" & Err & " " & Err.Description, vbCritical, "Warning"
    Resume Exit_cmdPhoto_Click
End Sub

 

Top
陈琳 发表于:2013-08-21 16:51:32

解决了。把 g_Server 替换成路径。谢谢5号老师。




总记录:1篇  页次:1/1 9 1 :