"Out of Memory" error in Lotus Notes automation from VBA -


this vba function sporadically fails notes automation error "run-time error '7' out of memory". naturally, when try manually reproduce it, runs fine.

function togmt(byval x date) date     static ntsession notessession     if ntsession nothing         set ntsession = new notessession         ntsession.initialize     end if (do stuff) end function 

to put in context, vba function being called access query, 3-4 times per record, 20,000 records. performance reasons, notessession has been made static. ideas why sporadically giving out-of-memory error?

(also, i'm initiating notessession can convert datetime gmt using lotus's rules. if know better way, i'm listening).

edit

per mr. ross's question, isolated (or thought did) query , it's supporting function. before tried suggestion, added arguments first determine row & field crashed on. ran few times , crashed on first field of first row.

then presto! ran fine. tried backtrack see did. couldn't find anything. went original query failing consistently , found ran fine though nothing had changed (or think).

so, couldn't try suggestion, still learned something. annoying me. function conflicting other notes process?

(1 other thing. can't hardware/memory issue. machine dual core 2gb ram.)

edit #2

this taking of time. i've decided hardcode dates. mr. ross, link looks solid, full-featured function, haven't time anymore check logic. here's went instead: (it works better thought purposes. expecting more discrepancies)

function togmt(byval x date) date     'ugly? yes. cheap hack? yes.      'but method fast , verifiable. let's go it.     'of course, if you're reading in year 2016, well,      'you should able figure out do.     if x >= #4/2/2006 1:00:00 am# , x <= #10/29/2006 3:00:00 am# or _         x >= #3/11/2007 1:00:00 am# , x <= #11/4/2007 3:00:00 am# or _         x >= #3/9/2008 1:00:00 am# , x <= #11/2/2008 3:00:00 am# or _         x >= #3/8/2009 1:00:00 am# , x <= #11/1/2009 3:00:00 am# or _         x >= #3/14/2010 1:00:00 am# , x <= #11/7/2010 3:00:00 am# or _         x >= #3/13/2011 1:00:00 am# , x <= #11/6/2011 3:00:00 am# or _         x >= #3/11/2012 1:00:00 am# , x <= #11/4/2012 3:00:00 am# or _         x >= #3/10/2013 1:00:00 am# , x <= #11/3/2013 3:00:00 am# or _         x >= #3/9/2014 1:00:00 am# , x <= #11/2/2014 3:00:00 am# or _         x >= #3/8/2015 1:00:00 am# , x <= #11/1/2015 3:00:00 am#             togmt = dateadd("h", -1, x)     else             togmt = x     end if end function 

what happens when change ntsession being static being setup on each call function , set nothing @ end of function?

i know hurt performance give shot , see happens , post back

edit:

your comment converting gmt got me thinking, funciton of good?

http://www.vbaexpress.com/kb/getarticle.php?kb_id=813


Comments

Popular posts from this blog

Delphi Wmi Query on a Remote Machine -