How to pass multiple values from Search result form to another form in access

Nancythomas

Registered User.
Local time
Today, 12:14
Joined
Apr 20, 2010
Messages
59
Hi
Can someone please show me how to pass multiple values from the search result form to another form. I have attached a sample access Database. I would like to pass multiple values from one form to another form.

Attached is the sample
EmpSearch_Frm hold the search results - I want to pass the results to AVLOG_Frm (TabPage LOGDetais).
Can you please help me with this....

Thanks
 

Attachments

you wouldnt pass the values, youd pass the query.
If form1 opens qsResults, then
form2 opens qsResults also.

form1 has the search criteria, then docmd.Openform form2
form2 is bound to the query, qsResults, for editing.
 
Another way to do this (which I do often) is to set your field values to TempVars or LocalVars when you perform the action that opens the subsequent form, and then immediately set the focus to the second form and run SetValue actions to set those TempVars into the respective fields.
 
Thanks as I am new to this, appreciate if you can please make the changes and email me the attachment.
Thanks
 
Okay, here you go. I've done two things:

1. I created an embedded macro behind that button on the EmpSearch_Frm that sets your TempVars on click and then opens the AVLOG_Frm

2. I set the fields on AVLOG_Frm to fetch those TempVars and set them as the default values in the fields (I didn't really know which fields you wanted the info in, so I just stuck them in the Dispatcher fields; take a look at those fields Default Values to see how I planted the data that was saved in the TempVars)

Hope that helps.
 

Attachments

Yes, it does work. I just downloaded it and checked it myself. Download the attachment, double click the EmpSearch_Frm to open it, and select an employee (or search for one). Then simply click the button below that employee, and the other form opens and loads that employee's info into the top row of your subform.

I don't understand where the problem is...
 
Hi I tried this, the problem is that after it feeds the information into the main form, it sits in memory, It changes all the existing records to have the same emp details.
 
Yes, that's probably correct. You asked specifically how to get info from one form to forward to another form when you click a button, and I've shown you how to do that. From your comment, it seems as though you're looking for more in-depth programming to get the data to enter into a table, as opposed to simply copying itself to another form.

I don't have any idea how your forms and tables are supposed to work, nor have I any idea how the person that's to use this form is supposed to do their job, so I can't possibly predict what you want me to do with your data beyond what you asked for. Since what you asked for was to get multiple fields from one form to another, I showed you how to do that. If you want a more in-depth solution that writes records to a table, you've got to explain the workflow to me so I understand how your data is to be used and stored.
 
Thank you for your quick reply.
I would like to take the data from the search result and load it to a table LOG_Details via the Form.
 
Okay, your database system needs some design tweaks, because your AVLOG_Frm has multiple possible records into which to write data. You'll have to have a way on your previous form, the EmpSearch_Frm, to select a specific record in your table. Then I'd use an Insert Into query statement to set the values from those TempVars directly into the table, and then in the next action, open the AVLOG_Frm and search for the record you just created.

Do you understand how to create an Insert Into statement?
 
Hi

This all sounds greek to me. I am just a beginner wanting to walk with big shoes....
Appreciate if you can please make the changes in my sample database and email it to me. That will be extremely helpful for me to understand this more.
 

Users who are viewing this thread

Back
Top Bottom