vba - How to use a function in filter string in access report? -



vba - How to use a function in filter string in access report? -

i have function defined in vba:

function isinweek(refdate date, checkdate date) boolean startdate = startofweek(refdate) enddte = endofweek(refdate) if (checkdate >= startdate , checkdate < enddate) isinweek = true else isinweek = false end if end function

i want utilize within filter clause of study follow:

strfilte = "isinweek(#" + format(indate, "dd/mm/yyyy") + "#, calanderdate)" docmd.openreport reportname, acviewpreview, reports(reportname) .filter = strfilter .filteron = true end

but doesn't work. study contains records. problem , how can solve it? using access 2003.

note: can utilize between implement function on filter string, looking find why above technique doesn't work.

edit 1

this not working too:

strfilte = "isinweek(#" + format(indate, "dd/mm/yyyy") + "#, [calanderdate])= true" if application.currentproject.allreports(reportname).isloaded = true docmd.close acreport, reportname end if docmd.openreport reportname, acviewdesign, strfilter docmd.openreport reportname, acviewpreview

the docmd.openreport method takes it's lastly parameter optional filter clause. maybe:

docmd.openreport reportname, acviewpreview, ,"isinweek(#" + format(indate, "dd/mm/yyyy") + "#, [calanderdate]) = true"

as far reason method tried doesn't work, remember access beingness particularly fussy reports (as opposed forms) regarding filter property; not sure if can on fly that. accomplish trying without using docmd.openreport filter option, think have open study in design mode, alter property, alter preview mode. remember forms beingness more forgiving this, however. that's memory, though.

edit: syntax incorrect, have added in comma between parameters; per http://msdn.microsoft.com/en-us/library/office/aa220304%28v=office.11%29.aspx, filtername 3rd param, wherecondition fourth. looking wherecondition.

vba access-vba ms-access-2003

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -