How To Open A Form To A Specific Record In Access 2016 VBA

In this post I am going to give you a basic example of how to open your Access form to a specific record.

This works in all versions of Access, but we are using Access 2016 in this example.

First create “parent and child” forms. In our case, it’s frmCustomers and frmOrders.

Here’s “frmCustomers”

Here’s “frmOrders”

I have it in datasheet format just for viewing purposes. The same principles will apply for “single form”.

When I click the button “View Orders For This Customer”, I get what I asked for.

Here’s the code:

Basically this says “Open the Orders form in datasheet view, where CustomerID is equal to the customer I am currently viewing”

The quotes are around Me.CustomerID because in this table it is a text value!

Exclude the quotes if you are searching for a number value.

Let me know if you need any specific help.


 

Watch how it’s done:

PS.

Need to pass multiple parameters? Click here



Free! Subscribe To Our YouTube Channel!

facebooktwittergoogle_plusredditpinterestlinkedinmailby feather
Tags: ,




 

Call Erik Now