ActiveGantt Activex control in MS Access 2013/365 - VBA Run-time errors on object methods -
i using ms access 365 (2013) , having run-time errors on simple calls object methods on activeganttvcctl object.
using supplied 'getting started' guide on activegantt website (http://www.sourcecodestore.com/article.aspx?id=15#create3), receiving run-time error (424 object required) on 1 of 4 lines of code following loop. code supplied here again convenience.
option compare database option explicit public function activeganttvcctl1() activeganttvcctl set activeganttvcctl1 = activeganttvcctl1a.object end function private sub form_load() dim integer activeganttvcctl1.columns.add "column 1", "", 125, "" activeganttvcctl1.columns.add "column 2", "", 100, "" = 1 10 activeganttvcctl1.rows.add "k" & i, "row " & i, true, true, "" next activeganttvcctl1.currentviewobject.timeline.position dateserial(2011, 11, 2) activeganttvcctl1.tasks.add "task 1", "k1", dateserial(2011, 11, 2) + timeserial(0, 0, 0), dateserial(2011, 11, 2) + timeserial(3, 0, 0), "", "", "" activeganttvcctl1.tasks.add "task 2", "k2", dateserial(2011, 11, 2) + timeserial(1, 0, 0), dateserial(2011, 11, 2) + timeserial(4, 0, 0), "", "", "" activeganttvcctl1.tasks.add "task 3", "k3", dateserial(2011, 11, 2) + timeserial(2, 0, 0), dateserial(2011, 11, 2) + timeserial(5, 0, 0), "", "", "" end sub
please note error not occur until line
activeganttvcctl1.currentviewobject.timeline.position dateserial(2011, 11, 2)
the reference activeganttvc scheduler component library has been included (it given compile error otherwise) , activegantt activex control exists on form named activeganttvcctl1a. have tried declaring activeganttvcctl object within form_load() function rather in separate function same result.
i have determined @ point of run-time error, able access activeganttvcctl1.currentviewobject.timeline object can run getxml method on without problems, not position method.
i have tried commenting particular line out, receive same run-time error on next line of code (the call tasks.add). creating further calls columns.add or rows.add methods, however, still appears work fine @ position in code.
is possible there issues in ms access 2013 not appear in ms access 2010 control?
this happening because version of activeganttvc using uses agvc.datetime instead of regular vb/vba date. agvc.datetime introduced in activeganttvc allow millisecond, microsecond , nanosecond accuracy (which turned out not idea @ all), next version of activeganttvc (3.2.0) use regular vb6/vba date (coledatetime c++ users). in meantime have use helper function when specifying date in activeganttvc:
public function fromdate(byval dtdate date) agvc.datetime dim dtreturn new agvc.datetime dim lyear long dim lmonth long dim lday long dim lhour long dim lminute long dim lsecond long lyear = year(dtdate) lmonth = month(dtdate) lday = day(dtdate) lhour = hour(dtdate) lminute = minute(dtdate) lsecond = second(dtdate) dtreturn.initialize lyear, lmonth, lday, lhour, lminute, lsecond, 0, 0, 0 set fromdate = dtreturn end function activeganttvcctl1.currentviewobject.timeline.position fromdate(dateserial(2011, 11, 2))
Comments
Post a Comment