vba - How To Output access Report with Condition -



vba - How To Output access Report with Condition -

good day dears

i have form run study status when run form filter(condition) work correctly report

but when create pdf( docmd.outputto) pdf homecoming value (the filter or status don't work).

this code

fsetaccesswindow (2) docmd.openreport "report1", acviewreport, _ "select * main id '" & nz(me.cmrtxt, "*") & "' , place_of_discharge_ar '" & nz(me.dischargecombo, "*") & "' , border '" & nz(me.bordercombo, "*") & "' , a_date between " & _ format(nz(me.statrdatetxt, "01/01/1900"), "\#mm\/dd\/yyyy\#") & " , " & _ format(nz(me.enddatetxt, "01/01/2900"), "\#mm\/dd\/yyyy\#"), , acdialog me.visible = true docmd.outputto acoutputreport, "report1", "", "", false, "", 0 fsetaccesswindow (sw_hide)

can 1 prepare me

kind regards

i base of operations study on query (if it's not already) , since know sql need study @ runtime, can replace sql in querydef exclusively (with proper filter) , output report. not need open in beforehand. omit openreport phone call , this:

currentdb.querydefs("qrymyreportbase").sql = "select * main id '" & nz(me.cmrtxt, "*") & "' , place_of_discharge_ar '" & nz(me.dischargecombo, "*") & "' , border '" & nz(me.bordercombo, "*") & "' , a_date between " & _ format(nz(me.statrdatetxt, "01/01/1900"), "\#mm\/dd\/yyyy\#") & " , " & _ format(nz(me.enddatetxt, "01/01/2900"), "\#mm\/dd\/yyyy\#") docmd.outputto acoutputreport, "report1", acformatpdf, "c:\mysavepath\report1.pdf", false

obviously, "qrymyreportbase" should report's source query , "c:\mysavepath\" should save path.

also, didn't see anywhere in outputto specifying type pdf. since that's mentioned above, i've added in.

vba ms-access access-vba

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -