Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recall last settings function 2

Status
Not open for further replies.

qqp

Programmer
Feb 23, 2016
34
US
Good morning!

I have a form (ReportParams) that supplies (criteria) values to various reports. End user would like to be able to recall the last values he used. I have no idea how to make this happen for him. Do any of you?

I thank you in advance for any insight, and hope ya'll are having a wonderful day!
 
Do you mean “last values he used” when he was using your app last week? Or, user creates a report and you clear all criteria values when the report is done, so user have to re-enter them again?

If the former, keep the criteria in your data base.

If the latter, don’t clear the values. Keep the criteria values on the form, but give them a way to clear it if the choose, like with a command button ‘Clear Criteria’



---- Andy

There is a great need for a sarcasm font.
 
I agree with Andy regarding storing the values in a table. To be more flexible in the future I would create a normalized table with fields like:

[pre]tblReportParams
rppRpPID primary key autonumber
rppUser You might use the same table for multiple users or even collections of values
rppForm Which form
rppControl Control Name on the form
rppValue store the actual value

[/pre]

You could use a little code in the on open of the form to find the particular user and run through the records to set the values. You would also either automatically save new values to the table or ask the user if they want to save. They might save multiple sets by adding a rppSetName field. Add a combo box to the form to allow selecting a particular set of values.


Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Thanks guys! That's kind of what I was thinking as well! Stay well my friends!
 
One more question, some of my fields are multi value fields, how should I store them and recall them?

Thanks again!
 
Could you give an example of your multi value fields?

You may be able to save them to the table, and retrieve them with Split() function.


---- Andy

There is a great need for a sarcasm font.
 
Sure! I have a list box for Salespeople, the multi select is set to Extended. The filter uses OR between names. For my own sanity I have a text box underneath the list that shows me the actual criteria, just using it until I have everything working properly. I don't use said text box in the filter, I use the list box.

Nearly all the selections are list boxes with multi select set to extended. There's a couple of date fields and a dollar amount field as well.

Thank you!
 
So, if your list box displays items:[tt]
1
2
4
7
9[/tt]

And user selects: [tt]1, 4[/tt], and [tt]9[/tt], you can save [tt]1 4 9[/tt] in one field, and then when you want to get it back, you can always use [tt]Split(DBField, “ “)[/tt] and you get the array with 3 elements: 1, 4, and 9

I am sure there is a better way to do it, too... :)


---- Andy

There is a great need for a sarcasm font.
 
Thanks Andy! I don't think I've used the split function before. I'll give it a shot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top