Using Option Buttons to search different tables

  • Thread starter Thread starter spnz via AccessMonster.com
  • Start date Start date
S

spnz via AccessMonster.com

HI there!!!

I am hoping someone can give me an idea on what im trying to achieve.

I have created a form that I wish to use as a search tool.

I have 2 option groups, The 1st has 3 buttons and the 2nd has 2.
1st group = optP45 optP60 optPayslip.
2nd group = optSurname optForename

I have 3 tables that I have created tblP45 tblP60 & tblPayslip.
I would like to have a textbox where I can enter a search criteria then
click a button and for the results to appear on the form.

Can anyone suggest how I can do this?
 
Couple of ways this is done.

(1) Write a query (that will be used as the form's record source) to return
the desired information. In the query, use criteria expressions that read
the values from the option groups and use them to filter the specific
fields' results. Put a button in the main form's header section; its Click
event should run code that will Requery the form.

(2) Write a query (and save it as qryMyQuery) to return the desired
information. Put a button in the main form's header section; its Click event
should run code that builds an SQL statement that uses qryMyQuery as the
base table, and that has criteria expressions that read the values from the
option groups and use them to filter the specific fields' results in this
query. Assign that SQL statement to the form's RecordSource property.

(3) Put a button in the main form's header section; its Click event should
run code that builds an SQL statement that uses the desired tables and that
has criteria expressions that read the values from the option groups and use
them to filter the specific fields' results in this query. Assign that SQL
statement to the form's RecordSource property.
 
Back
Top