Hi, ive got an sql string that works fine. The sql string is generated in an afterupdate even of a list box in VB.
Im having a bit of trouble getting it from the form to the report (string name is Reportsql, and report name is rptRemitance). i think its to do with it being global? But when i try and declare reportsql as global it doesnt let me (perhaps because im in a private sub?).
Ive got a piece of code on a command button to open the report: Call DoCmd.OpenReport("rptRemitance", acViewPreview, , ReportSql) that doesnt work, ive also tried setting the me.recordsource reportsql on the report open its self. The immediate window shows that neither the click sub or report open sub`s are getting the sql string into them?
Am i doing something wrong? I dont really want to move my code into a function in a module id rather keep it in the after update event of the list box.
Also completly differnt question, how can i change the contents of a txt box on one form from a sub form after update event? I keep getting the error message "Object not found" Is it something like me.forms.frmPayment.txtSelectedTotal = "x" ?
Thanks for your replies in advance!
Im having a bit of trouble getting it from the form to the report (string name is Reportsql, and report name is rptRemitance). i think its to do with it being global? But when i try and declare reportsql as global it doesnt let me (perhaps because im in a private sub?).
Ive got a piece of code on a command button to open the report: Call DoCmd.OpenReport("rptRemitance", acViewPreview, , ReportSql) that doesnt work, ive also tried setting the me.recordsource reportsql on the report open its self. The immediate window shows that neither the click sub or report open sub`s are getting the sql string into them?
Am i doing something wrong? I dont really want to move my code into a function in a module id rather keep it in the after update event of the list box.
Also completly differnt question, how can i change the contents of a txt box on one form from a sub form after update event? I keep getting the error message "Object not found" Is it something like me.forms.frmPayment.txtSelectedTotal = "x" ?
Thanks for your replies in advance!