Automatically pick up the ContactID in a form

T

Terra

Automatically pick up the ContactID in a form
On my frmContacts I have a button “Preview BOID Rpt†the button is linked to
open a report that is based on the user entering the contacts ID number. I
would like to have this button automatically pick up this number (the record
that the user is currently on) when the "Preview BOID Rpt" is clicked. Rather
than having to enter it manually.

Whoever can help, I would greatly appreciate it.
Thanks!
Terra
 
J

Jeff Boyce

Terra

How does your form (frmContacts) "know" which contact to display?

It all starts with the data! What data are you using to display via the
form? Is ContactID one of those pieces of data? Is that ContactID showing
in a control (e.g., a textbox)? Could it be bound to a textbox, even if
that textbox was not visible?

You can have your report be based on a query that "points to" the textbox on
the form that holds the value of the ContactID. Depending on how you've
named your control, your query might have something like the following in
the selection criterion under the ContactID field:

Forms!frmContacts!txtContactID

This way, when you open the report (with your command button), the report
looks to the query, the query looks to the form, and the report opens only
with the record being displayed on the form.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
T

Terra

Thank you Jeff it worked!
Terra

Jeff Boyce said:
Terra

How does your form (frmContacts) "know" which contact to display?

It all starts with the data! What data are you using to display via the
form? Is ContactID one of those pieces of data? Is that ContactID showing
in a control (e.g., a textbox)? Could it be bound to a textbox, even if
that textbox was not visible?

You can have your report be based on a query that "points to" the textbox on
the form that holds the value of the ContactID. Depending on how you've
named your control, your query might have something like the following in
the selection criterion under the ContactID field:

Forms!frmContacts!txtContactID

This way, when you open the report (with your command button), the report
looks to the query, the query looks to the form, and the report opens only
with the record being displayed on the form.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top