Select the Correct Record with a Button in an Access Continuous Form
Question details
Select the record containing a clicked control before running an action in an Access continuous form.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A continuous form displays an image or button for each record, and clicking it should open or query data for that record.
- Observed behavior
- Clicking the control uses the first record instead of the record containing the clicked control.
Open the continuous form in Design View and confirm that its record source includes the key field, such as Auto_ID. Check that the related form also has a field that can be used to filter the matching record.
Place a transparent command button over the image
Use a focusable button to select the clicked record and run an action with its current key.
Open the form in Design View, select Design > Button, and draw a button over the image in the form's Detail section. If the Command Button Wizard opens, cancel it.
Select the button, open its Property Sheet, and set Transparent to Yes on the Format tab. Use Arrange > Bring to Front so the button sits above the image.
In the button's Property Sheet, open the Event tab, set On Click to [Event Procedure], and select the build button (...) to open the VBA editor.
Between the generated Sub and End Sub lines, enter: DoCmd.OpenForm "DB_Notes", , , "Auto_ID = " & Me!Auto_ID. Replace DB_Notes and Auto_ID with your form and key field names if needed.
Save the form, switch to Form View, and click the image area on several records. Confirm that the related form opens with the matching record each time.

Manage tabular data with WPS Spreadsheets
WPS Office is a free, lightweight alternative for working with office files in a familiar interface. Open compatible Microsoft Office files to move everyday document and spreadsheet work to WPS. It does not run Access forms or fix Access-specific behavior.

Frequently Asked Questions
Why does my Access form use the first record when I click an image?
The image click may not move focus to the record you clicked, so code that reads the current record can use a different record. Place a command button over the image and run the action from the button's On Click event.
Where do I enter the code for the transparent button?
In Design View, select the button and open Property Sheet > Event. Set On Click to [Event Procedure], select the build button (...), and add your code inside the generated VBA procedure.
How does the button open the record with the matching Auto_ID?
The button's Click event can use DoCmd.OpenForm with a WhereCondition, such as "Auto_ID = " & Me!Auto_ID. The example requires a numeric Auto_ID in both the current form and the related form's record source.
Can I click the image directly instead of using a button?
An image may need to be bound to a field so Access can focus the correct record. If direct image clicks do not select the expected record, use a transparent command button over the image and test it on several records.




