Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7892521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:53:29+00:00 2026-06-03T06:53:29+00:00

I have two tables and a form in a Microsoft Access Database. Lets the

  • 0

I have two tables and a form in a Microsoft Access Database. Lets the first table tblCUSTOMERS, and the second table tblINVOICES. tblCUSTOMERS contains fields called CustomerID (primary key), FirstName, and LastName. tblINVOICES contains fields called InvoiceID (primary key), CustomerID (foreign key), and Amount. The form is called frmInvoices and contains textboxes for the fields in tblINVOICES.

What I what to do is create functionality that allows me to search through my customers table, select a customer record from that table, and then return the CustomerID of that record to frmInvoices. Ideally the searching would be in a format like a data grid that allows searching by FirstName, LastName, and CustomerID.

Specifically can you advise me of the simplest way to:
1. Insert a form (lets call this new form frmCUSTOMERS) with something like a datagrid control to show customer records.
2. Update the datagrid on frmCUSTOMERS to display only records matching a query of tblCUSTOMER (such as only customers where firstname starts with ‘B’)
3. Pass the CustomerID from frmCUSTOMERS to frmINVOICES.

Many thanks,

Brett

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:53:31+00:00Added an answer on June 3, 2026 at 6:53 am

    You can pass a value as an opening argument to a form when you open it.

    DoCmd.OpenForm "frmFormName", , , , , ,"B"
    

    Or you can pass in a criteria statement:

    DoCmd.OpenForm "frmFormName", , , "FirstName LIKE 'B*'"
    

    If you go the first route you would do something like this:

    Private Sub Form_Load()
        Me.Filter = "FirstName LIKE '" & Nz(Me.OpenArgs, "") & "*'"
        'or
        Me.Subform1.Form.Filter = "FirstName LIKE '" & Nz(Me.OpenArgs, "") & "*'"
    End Sub
    

    To hand a value such as CustomerID back from the search form, there are numerous options. You could put the value in a global variable. Or you could have the search form give the value back to the calling form by using a Public Variable or Public Function on the calling form.

    Arguably, a more correct and cleaner way of doing all this would be to design a Class that handles opening the search form and passing of the inbound and outbound values. Classes do take more knowledge and skill to write and it would probably be overkill for what you are trying to do. A class is certainly not required to make this work. It would only be a little cleaner. In reality, you would use many of the same techniques I listed above if you did write a class for this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables: a schedule table that contains information about how an employee
Lets say I have two tables, one for transactions, and another table who's primary
I have two tables in my access database that I want to be able
I have two tables in my database cars and car_types. cars table refers to
I have two tables in a 2010 Access Database. One for Customers and One
I have two tables, the first has a primary key that is an identity,
I have two tables, one for routes and one for airports. Routes contains just
I have two tables, for example: Table A Table B ======= ======= Name |
I have two tables, the structure of the first partially recapitulates, iterates the structure
I have two tables: attractions and cities. Attractions contains a column called city, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.