ms access - Open Report based on text field -
i have form button , text box other data. need open report calculated fields based on value entered in text box when button pressed. when user enters value text box open report fields value.
currently using
private sub command11_click() docmd.openreport "mileage", acviewpreview, , "truck #" & me.frmtruck.value & "'" end sub
this work if did not try find text box on opened report named truck #(enteredvalue) sure missing since have done before can't place on how filter based on text box.
assuming record source of report includes field named truck #, enclose name in square brackets when create wherecondition option openreport
, ie [truck #]
then, if datatype of field numeric ...
docmd.openreport "mileage", acviewpreview, , "[truck #] = " & me.frmtruck.value
or if datatype text ...
docmd.openreport "mileage", acviewpreview, , "[truck #] = '" & me.frmtruck.value & "'"
note, if me.frmtruck
not text box mentioned user enters search value, replace correct text box name.
Comments
Post a Comment