|
2#
楼主 |
发表于 2011-10-23 22:32:54
|
只看该作者
本帖最后由 williamwangc 于 2011-10-23 22:34 编辑
现在在这段功能函数在实际应用中出现了问题,希望有人解答一下。
代码如下:- Dim str_school As String
- Dim str_class As String
- Dim str_path As String
- Dim str_update1 As String
- Dim str_update2 As String
- str_path = CurrentProject.path & "" & "导入资料.xls"
- str_school = str_excel(str_path, 2, 2)
- str_class = str_excel(str_path, 4, 2)
- Debug.Print str_school
- Debug.Print str_class
- DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "资料", str_path, True, "Sheet1!A6:B20"
- str_update1 = "UPDATE [资料] SET [学校]=str_school WHERE [学校]='' "
- DoCmd.RunSQL str_update1
- str_update2 = "UPDATE [资料] SET [班级]=str_class WHERE [班级]='' "
- DoCmd.RunSQL str_update2
复制代码 发现这段代码有两大问题
1.两段DEBUG.PRINT显示的内容是一样的,是不是函数在设置的时候应该用BYREF比较正确呢?
2.在两段UPDATE里面无法发现str_school和str_class的值,这是怎么回事? |
|