ms access 2007 - data type mismatch in FtpFindFirstFile -
i enumerating ftp directory using following function:
public sub enumfiles(hconnect long) const cstrprocedure = "enumfiles" dim pdata win32_find_data, hfind long, lret long dim strsubcode string dim sql string on error goto handleerror sql = "insert tblincomingfiles (availablefile) values ('" & pdata.cfilename & "')" 'get sub code search strsubcode = getsubscribercode 'create buffer pdata.cfilename = string(max_path, 0) 'find first file hfind = ftpfindfirstfile(hconnect, "*" & strsubcode & "*", pdata, 0, 0) 'if there's no file, exit sub if hfind = 0 exit sub 'show filename debug.print left(pdata.cfilename, instr(1, pdata.cfilename, string(1, 0), vbbinarycompare) - 1) currentdb.execute sql 'create buffer pdata.cfilename = string(max_path, 0) 'find next file 'lret = ftpfindnextfile(hfind, pdata.cfilename) 'if there's no next file, exit if lret = 0 exit 'show filename 'me.print left(pdata.cfilename, instr(1, pdata.cfilename, string(1, 0), vbbinarycompare) - 1) currentdb.execute sql loop 'close search handle handleexit: exit sub handleerror: errorhandle err, erl(), cstrmodule & "." & cstrprocedure resume handleexit end sub i keep getting data type mismatch (error 13) in line:
hfind = ftpfindfirstfile(hconnect, "*" & strsubcode & "*", pdata, 0, 0) and highlights pdata. have declared pdata win32_find_data @ top of function, , win32_find_data declared type in module.
public declare function ftpfindfirstfile lib "wininet.dll" alias "ftpfindfirstfilea" _ (byval hftpsession long, byval ssearchfile string, byval lpfindfiledata long, _ byval lflags long, byval dwcontext long) long private type win32_find_data dwfileattributes long ftcreationtime filetime ftlastaccesstime filetime ftlastwritetime filetime nfilesizehigh long nfilesizelow long dwreserved0 long dwreserved1 long cfilename string * max_path calternate string * 14 end type any idea why might getting error?
i have working example found here, , ftpfindfirstfile declaration different yours. mine is
private declare function ftpfindfirstfile lib "wininet.dll" alias "ftpfindfirstfilea" _ (byval hftpsession long, byval lpszsearchfile string, lpfindfiledata win32_find_data, _ byval dwflags long, byval dwcontent long) long
Comments
Post a Comment