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!

Forms and query parameters autofill from previous form 2

Status
Not open for further replies.

cortextual

Technical User
Jun 29, 2016
3
CA
I am a fairly new access user and I have been tasked with debugging and restructuring an existing database for my small company. There is one main issue that I have been unable to resolve and I was hoping someone could suggest a strategy to handle it.

The purpose of the database is to store information for each of our clients, including the company info, the products they subscribe to, and their billing information. Then the database is used to determine who to bill each month and to make the invoices.

The overall issue is that the user has to re-enter the same information every time they open the next form or run a query from a form. For example when we add a new client to the database, the user will go through multiple forms for the same company and each time they open a new form they have to re-select the company. A variant of this issue is that when they run a query through a command button on a form they are asked to re-enter parameters that are already filled out in the form.

I've been looking at forums and have found a few suggestions, but nothing seems to work consistently. I've been trying things like setting the where conditions in openform macros or setting the last entered record to default, but I think I need a more system-wide solution if possible.

I'm a bit stuck on where to go from here, so any suggestions are welcome! I can provide more information about the database as well.
 
You have your Client information in Clients table (I assume). So if the User selects a Client (avoid entering information you already store), you may just store ClientID in a Global variable (in standard Module).
Then, in any Form / query that you need to re-call this information anywhere in your app, just grab the info from your Clients table based on stored ClientID

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Without knowing a lot more of how your table structure and how the forms are designed I am only guessing. It sounds to me that you create a client and then you have multiple forms to add child records to that client or information related to the Client. If you can tell us about those forms and what they do it would help. Often this is done with a main form and then subforms on possibly a tab control. On the first tab would be stuff like company information, second tab products, etc. With this design it is easy to stay on the current client by linking the main form to the subforms. But instead your design uses separate forms. On those forms you now have to tell it which client you are working on. Depending on how you open the form you could save the "current Client ID" in either a global variable or in a small table. Then when you open the form you could set the client ID to the current client id.
 
Thanks MajP and Andrzejek,

Setting the client ID as a global variable worked for the forms!

To solve the issue with the queries I found a suggestion to set the criteria as [Forms]![FormName].[Field] with the field being the combobox on the form where the parameter was already filled out. Not sure if that was an obvious fix but it worked for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top