Show only selected data in form

Riaang

Board Regular
Joined
Aug 29, 2002
Messages
146
Hi, I have set up a database with different forms. Each form will be used by different departments. On the first form the new data will be captured and in the user name box will be allocated to certain users. On the second form the users must be able to display only the records that are allocated to them. How can I change the second form that by selecting the user name it will only show their records.

I will appreciate any help.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi Riaang,

Set the second form's recordsource to a query. Have the query contain the same table the form should normaly edit, but set the criteria field of the user field to the control on the first form that contains the users name.

To do this, open both forms, then create a query in design view. Add the table of interest to the query, and set the criteria for the user field to the control that contains the user's name on the first form. Right click on the criteria field and select "build" and use the expression builder to find this control if you need help with the syntax.

I would then have a button on the first form that opens the second form, and when pressed. Since this second form looks for the use's name from this first form, when the second form is opened, it's record source will only be the records relating to the user specified in the first form.

You might need to lock the control holding the user name in the first form when they press the button to open the second form, so they don't go and change it. You could unlock when they close the second form.

HTH,
 
Upvote 0

Forum statistics

Threads
1,223,534
Messages
6,172,893
Members
452,487
Latest member
ISOmark26

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top