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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -