![]() | |
#21
| |||
| |||
|
|
"Phil" <phil (AT) stantonfamily (DOT) co.uk> skrev i en meddelelse news:j2r8ic$oea$1 (AT) speranza (DOT) aioe.org... On 20/08/2011 23:34:56, "bsn" wrote: "Phil" <phil (AT) stantonfamily (DOT) co.uk> skrev i en meddelelse news:j2ojhi$6v6$1 (AT) speranza (DOT) aioe.org... On 20/08/2011 15:51:24, "bsn" wrote: VinduespudserProgramD:\Users\Bjarne\Desktop\vindue spudser_2010_Win7.accde Have you tries Debug.Print Dir("D:\Users\Bjarne\Desktop\vinduespudser_2010_Wi n7.accde") Does the file exist? Phil Yes - VinduespudserProgram variable holds the path+dbname... Bjarne Sorry then Bjarne. I give up. The VBA I gave you works for me OK. Might be worth having a look at the .Bat file with a hex editor, to see what characters are giving you the unwanted line feeds. This is a free editor http://www.hhdsoftware.com/free-hex-editor Phil Thx for ur patience... Ill try the hexeditor, and Ill try another setup to - winxp+access2003.... I tell u about the result later... Bjarne |
#22
| ||||
| ||||
|
|
I don't use the File System Object, though various "experts" have recommended it. (But they don't mention that some {perhaps many} system adminstrators delete the Windows Scripting Host from all systems under their control because they consider it a security list. Some even go so far as to periodically check to see if some "rogue software" has reinstated it.) That does not seem to be your problem. And, back when the "experts" began recommending it as "latest and greatest", I compared various functionality using FSO versus identical functionality using the built-in VBA File I/O statements, and, in no case was the FSO version either shorter or discernably faster. Your problem appears from the discussion to be in concatenating the strings. I suggest you perform the concatenation separately, and test that it executed correctly by using Debug.Print and examining the output in the Immediate Window. |
|
But, IMNSHO, the best advice you received was to use the built-in VBA File I/O statement "FileCopy" to copy the external files from within Access. |
|
As a matter of fact, I've recently started a series of presentations and examples to refresh our memory about these i/o statements in VBA. They are almost identical to the statements from QuickBASIC, TurboBASIC, and other early versions of BASIC, long before there was either Windows or VBA. |
|
"bsn" <bsnSNABELAoncableDOTdk> wrote in message news:4e5173d8$0$56784$edfadb0f (AT) dtext02 (DOT) news.tele.dk... "Phil" <phil (AT) stantonfamily (DOT) co.uk> skrev i en meddelelse news:j2r8ic$oea$1 (AT) speranza (DOT) aioe.org... On 20/08/2011 23:34:56, "bsn" wrote: "Phil" <phil (AT) stantonfamily (DOT) co.uk> skrev i en meddelelse news:j2ojhi$6v6$1 (AT) speranza (DOT) aioe.org... On 20/08/2011 15:51:24, "bsn" wrote: VinduespudserProgramD:\Users\Bjarne\Desktop\vindue spudser_2010_Win7.accde Have you tries Debug.Print Dir("D:\Users\Bjarne\Desktop\vinduespudser_2010_Wi n7.accde") Does the file exist? Phil Yes - VinduespudserProgram variable holds the path+dbname... Bjarne Sorry then Bjarne. I give up. The VBA I gave you works for me OK. Might be worth having a look at the .Bat file with a hex editor, to see what characters are giving you the unwanted line feeds. This is a free editor http://www.hhdsoftware.com/free-hex-editor Phil Thx for ur patience... Ill try the hexeditor, and Ill try another setup to - winxp+access2003.... I tell u about the result later... Bjarne |
#23
| |||
| |||
|
|
"bsn" <bsnSNABELAoncableDOTdk> skrev i en meddelelse news:4e5173d8$0$56784$edfadb0f (AT) dtext02 (DOT) news.tele.dk... "Phil" <phil (AT) stantonfamily (DOT) co.uk> skrev i en meddelelse news:j2r8ic$oea$1 (AT) speranza (DOT) aioe.org... On 20/08/2011 23:34:56, "bsn" wrote: "Phil" <phil (AT) stantonfamily (DOT) co.uk> skrev i en meddelelse news:j2ojhi$6v6$1 (AT) speranza (DOT) aioe.org... On 20/08/2011 15:51:24, "bsn" wrote: VinduespudserProgramD:\Users\Bjarne\Desktop\vindue spudser_2010_Win7.accde Have you tries Debug.Print Dir("D:\Users\Bjarne\Desktop\vinduespudser_2010_Wi n7.accde") Does the file exist? Phil Yes - VinduespudserProgram variable holds the path+dbname... Bjarne Sorry then Bjarne. I give up. The VBA I gave you works for me OK. Might be worth having a look at the .Bat file with a hex editor, to see what characters are giving you the unwanted line feeds. This is a free editor http://www.hhdsoftware.com/free-hex-editor Phil Thx for ur patience... Ill try the hexeditor, and Ill try another setup to - winxp+access2003.... I tell u about the result later... Bjarne HexEditor result : 65 63 68 6f 20 6f 66 66 0d 0a 22 63 6f 70 79 20 0d 0a 44 3a 5c 55 73 65 72 73 5c 42 6a 61 72 6e 65 5c 44 65 73 6b 74 6f 70 5c 76 69 6e 64 75 65 73 70 75 64 73 65 72 5f 32 30 31 30 5f 57 69 6e 37 2e 61 63 63 64 65 20 0d 0a 44 3a 5c 55 73 65 72 73 5c 42 6a 61 72 6e 65 5c 44 65 73 6b 74 6f 70 5c 62 73 6e 64 61 74 61 5f 76 69 6e 64 75 65 73 70 75 64 73 65 72 5f 32 30 31 30 5f 57 69 6e 37 2e 61 63 63 64 65 22 0d 0a echo off.. "copy .. D:\Users\Bjarne\Desktop\vinduespudser_2010_Win7.ac cde .. D:\Users\Bjarne\Desktop\bsndata_vinduespudser_2010 _Win7.accde" /HexEditor result Can u read it...??? The winxp+access2003 gave the same result as above...:-(( Bjarne No problem reading it. the significant bit is the 0d 0a combination which in VBA terms is Chr$(13) & Chr$(10) or VbCrLf That sequence appears after echo off |
#24
| |||
| |||
|
|
Your problem appears from the discussion to be in concatenating the strings. I suggest you perform the concatenation separately, and test that it executed correctly by using Debug.Print and examining the output in the Immediate Window. "concatenation separately", am I not doing it now...??? |
|
But, IMNSHO, the best advice you received was to use the built-in VBA File I/O statement "FileCopy" to copy the external files from within Access. I tried the FileCopy statement - the result was a file error... Runtime Error 52 Bad file name or number |
#25
| |||
| |||
|
|
"bsn" <bsnSNABELAoncableDOTdk> wrote Your problem appears from the discussion to be in concatenating the strings. I suggest you perform the concatenation separately, and test that it executed correctly by using Debug.Print and examining the output in the Immediate Window. "concatenation separately", am I not doing it now...??? From your first post in this thread: MyFile.WriteLine ("copy " & Folder & Filename & " " & Folder & "test_" & Filename)... No, you are concatenating in the same statement in which you write the line. Try: Dim strFirst as String strFirst = "copy" & Folder debug.print strFirst strFirst = strFirst & Filename debug.print strFirst strFirst = strFirst & " " debug.print strFirst strFirst = strFirst & Folder debug.print strFirst strFirst = strFirst & "test_" debug.print strFirst strFirst = strFirst & Filename I used separate concatenations for each term, so it would be easier to determine which term might be causing a problem. But, IMNSHO, the best advice you received was to use the built-in VBA File I/O statement "FileCopy" to copy the external files from within Access. I tried the FileCopy statement - the result was a file error... Runtime Error 52 Bad file name or number I've never had trouble with FileCopy provided I used a valid file name, either fully-qualified with path, or just the file name if in the current folder. Try using debug.print to display the file names in the Immediate Window. I am currently using Win XP and Access 2003 (with all the current service packs and fixes that Microsoft distributes for both). Was, perhaps, the file open when you tried "FileCopy"? The Help for FileCopy in Access 2003 ends with the Remark: "If you try to use the FileCopy statement on a currently open file, an error occurs." Just to refresh my memory, I just tried the following and both FileCopy commands were successful: FileCopy "C:\\data\Access\Access2003\CopyThisFileOne.tx t", "C:\\data\Access\Access2003\CopiedFileOne.txt" FileCopy "CopyThisFileTwo.txt", "CopiedFileTwo.txt" The commands, as tested, were in the click event of a Command Button. |
#26
| |||
| |||
|
|
On 20/08/2011 23:34:56, "bsn" wrote: "Phil" <phil (AT) stantonfamily (DOT) co.uk> skrev i en meddelelse news:j2ojhi$6v6$1 (AT) speranza (DOT) aioe.org... On 20/08/2011 15:51:24, "bsn" wrote: VinduespudserProgramD:\Users\Bjarne\Desktop\vindue spudser_2010_Win7.accde Have you tries Debug.Print Dir("D:\Users\Bjarne\Desktop\vinduespudser_2010_Wi n7.accde") Does the file exist? Phil Yes - VinduespudserProgram variable holds the path+dbname... Bjarne Sorry then Bjarne. I give up. |
#27
| |||
| |||
|
|
"Access Developer" <accdevel (AT) gmail (DOT) com> skrev i en meddelelse news:9bihghFnkbU1 (AT) mid (DOT) individual.net... "bsn" <bsnSNABELAoncableDOTdk> wrote Your problem appears from the discussion to be in concatenating the strings. I suggest you perform the concatenation separately, and test that it executed correctly by using Debug.Print and examining the output in the Immediate Window. "concatenation separately", am I not doing it now...??? From your first post in this thread: MyFile.WriteLine ("copy " & Folder & Filename & " " & Folder & "test_" & Filename)... No, you are concatenating in the same statement in which you write the line. Try: Dim strFirst as String strFirst = "copy" & Folder debug.print strFirst strFirst = strFirst & Filename debug.print strFirst strFirst = strFirst & " " debug.print strFirst strFirst = strFirst & Folder debug.print strFirst strFirst = strFirst & "test_" debug.print strFirst strFirst = strFirst & Filename I used separate concatenations for each term, so it would be easier to determine which term might be causing a problem. But, IMNSHO, the best advice you received was to use the built-in VBA File I/O statement "FileCopy" to copy the external files from within Access. I tried the FileCopy statement - the result was a file error... Runtime Error 52 Bad file name or number I've never had trouble with FileCopy provided I used a valid file name, either fully-qualified with path, or just the file name if in the current folder. Try using debug.print to display the file names in the Immediate Window. I am currently using Win XP and Access 2003 (with all the current service packs and fixes that Microsoft distributes for both). Was, perhaps, the file open when you tried "FileCopy"? The Help for FileCopy in Access 2003 ends with the Remark: "If you try to use the FileCopy statement on a currently open file, an error occurs." Just to refresh my memory, I just tried the following and both FileCopy commands were successful: FileCopy "C:\\data\Access\Access2003\CopyThisFileOne.tx t", "C:\\data\Access\Access2003\CopiedFileOne.txt" FileCopy "CopyThisFileTwo.txt", "CopiedFileTwo.txt" The commands, as tested, were in the click event of a Command Button. thx very much for answer... I found the error at last...:-)) I had a vbCrLf inserted in my code in a function...:-(( I got the hint from the hex editor... Bjarne |
#28
| |||
| |||
|
|
And, back when the "experts" began recommending it as "latest and greatest", I compared various functionality using FSO versus identical functionality using the built-in VBA File I/O statements, and, in no case was the FSO version either shorter or discernably faster. |
#29
| |||
| |||
|
|
I found the error at last...:-)) I had a vbCrLf inserted in my code in a function...:-(( I got the hint from the hex editor... |
![]() |
| Thread Tools | |
| Display Modes | |
| |