Command Button to Select Records based on a set Criteria (1 Viewer)

MatthewB

Member
Local time
Today, 13:55
Joined
Mar 30, 2022
Messages
85
So far in my attempt to build a database my search buttons execute code based on the content entered into an unbound text box. It would be much simpler in certain circumstances to have a button that selects all the records based on the string value of a field. You can see my thought in the Quoting_Detail_F_C. I really do not understand how to do this, even though I am sure it is quite simple.

Can you help?
 

Attachments

  • MyTestDatabase.accdb
    3.9 MB · Views: 174

Gasman

Enthusiastic Amateur
Local time
Today, 21:55
Joined
Sep 21, 2011
Messages
14,276
You would just refer to the control and not your search control?
No real need for a button. I would use the double click event of the control(s).
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:55
Joined
May 21, 2018
Messages
8,527
It would be much simpler in certain circumstances to have a button that selects all the records based on the string value of a field.
If you want to filter by a value in a field you do not need any code.
filter.jpg
 

mike60smart

Registered User.
Local time
Today, 21:55
Joined
Aug 6, 2017
Messages
1,904
So far in my attempt to build a database my search buttons execute code based on the content entered into an unbound text box. It would be much simpler in certain circumstances to have a button that selects all the records based on the string value of a field. You can see my thought in the Quoting_Detail_F_C. I really do not understand how to do this, even though I am sure it is quite simple.

Can you help?
Hi Mathew

Took a quick look and the first table "Contractor_T" is constructed incorrectly.

It has Repeating Groups - your fields for Contact1, Contact2, Contact3, Contact4 & Contact5
These should all be records in a related table.

You are also using Lookup Fields in this table which are a NO NO.
Search the Web for "The Evils of Lookup Fields in Access Tables"
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:55
Joined
Feb 19, 2002
Messages
43,266
What are all those buttons with project numbers? If you want to search by project, just use a combo.

Also, you haven't fixed any of your repeating groups.
 

MatthewB

Member
Local time
Today, 13:55
Joined
Mar 30, 2022
Messages
85
What are all those buttons with project numbers? If you want to search by project, just use a combo.

Also, you haven't fixed any of your repeating groups.
They represent buildings I manage. This form represents a schedule of annual events. So when I visit this form I am always interested to review one building only, not every building I manage. It would be convenient to have a button that filters for kf_StrataPlan_ID = "a pre-determined StrataPlanNr"
 

mike60smart

Registered User.
Local time
Today, 21:55
Joined
Aug 6, 2017
Messages
1,904
They represent buildings I manage. This form represents a schedule of annual events. So when I visit this form I am always interested to review one building only, not every building I manage. It would be convenient to have a button that filters for kf_StrataPlan_ID = "a pre-determined StrataPlanNr"
Hi Mathew

The standard method of selecting a Building is as shown in the attached screenshot.

This is achieved by creating a table to store your List of Buildings and
a related table that contains all related data.

The list of Buildings has a PK and the related table has a FK as shown in the relationship diagram attached.

You then create a Main Form based on tblStrataPlanNumbers and a Subform based
on StratPlan_T.

These Forms are linked with Referential Integrity set on StrataPlanID

In the header of the Main form you then create a Combobox which allows you to select a specific Building
 

Attachments

  • Normal.JPG
    Normal.JPG
    73 KB · Views: 83
  • ER Diagram.JPG
    ER Diagram.JPG
    40.1 KB · Views: 77

Users who are viewing this thread

Top Bottom