getting data from a button procedure into a query (for a report)

  • Thread starter Thread starter Bob O`Bob
  • Start date Start date
B

Bob O`Bob

Access isn't my strong suit... nonetheless, I'm giving it a try.


Application has a form, on that form is a subform, and on that subform is
a button. The button currently invokes a report with syntax like:

DoCmd.OpenReport strReportName, acNormal

The report relies on a query, and what that query really needs is to get the
data from one of the fields on the subform. Currently it's operating as
a parameter, so every time one clicks the button, the parameter window pops
up and asks for the code. This is obviously not necessary, but I'm not
sure what a "right way" would be. Please suggest one, or let me know what
sort of other information you'd need from me.



Bob
 
Replace the parameter in the query with an expression similar to the
following (substitute your real names):

[Forms]![myFormName]![mySubFormName]![myTextBoxName]

where myFormName is the name of the form, mySubFormName is the name of the
subform control (on myFormName) that holds the subform (note: this may or
may not be the same name as the form that is serving as the subform), and
myTextBoxName is the name of the textbox that has the desired value on the
subform.
 
Ken said:
Replace the parameter in the query with an expression similar to the
following (substitute your real names):

[Forms]![myFormName]![mySubFormName]![myTextBoxName]

where myFormName is the name of the form, mySubFormName is the name of the
subform control (on myFormName) that holds the subform (note: this may or
may not be the same name as the form that is serving as the subform), and
myTextBoxName is the name of the textbox that has the desired value on the
subform.

Thanks much. I won't know until morning, since I don't have the code,
but I'm pretty sure that wasn't among the combinations we tried.


Bob
 
Back
Top