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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remebering Form Entries from previous runs 2

Status
Not open for further replies.

ztchnc

Programmer
Jun 28, 2004
6
US
I am new to Access forms and just recently started working with them. I have already created a form and it runs pretty well but I want to make it a little better. The form contains a few unbound text boxes that the user inputs values before running the commands. I want to know if there is a way to possibly keep track of the values entered so that next time the person runs the form again he/she doesn't have to retype anything that they may have entered before. Just like the Autocomplete in Explorer, just someway to not have to type anything that was typed in before for each individual text box. I was thinking of binding the text boxes to different tables but that would be too many, I think. What would be the best way to go about this? I'm just trying to get suggest and maybe some examples. Thank You.
 
Unfortunately I don't have any sample code to give you but this verbal explanation might point you in the right direction.

First off, the only way that I know of to do what you want is to use a combobox, not a textbox. Essentially, as the user finishes typing in the text you want to add it to the comboboxes rowsource (for future use). The problem is you cannot do so while the form is open. So you need to keep that information in a global variable (I.e. define it as public in a module). When the form closes, open it again (hidden) in design mode*, set the control's rowsource**, save and close the form. Then the next time the form opens and the users starts typing in something that has already been entered it will work similar to the autocomplete feature you're looking for.

Try it out and reply again to the thread if you run into any problems.


* DoCmd.openForm <name of form>, acDesign, , , , acHidden

** If control's rowsource = null then set rowsource = control's value, otherwise control's rowsource = ";" and control's value
 
Hi

MAke a table with columns to save the value of each control on the form

Make the form a bound form, (bound to the above table), and make the source of each control the appropriate column in the table

If you want to have a set of 'last used' data for 'n' users include a column to identify the USer (Windows) and filer the table on that column

You can retrieve Windows USer Id using =Environ("USERNAME") or via a function with an API call

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks For the help guys, I just used tables to store the information and used a query to populate the fields when the user made a choice from a combobox.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top