Solved

Reference field on popup form

Posted on 2011-02-11
5
225 Views
Last Modified: 2012-06-21
i have a pop up form that contains a listbox with names  how do i reference the selection the user makes back in my main form
0
Comment
Question by:ChuckRush
  • 3
  • 2
5 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 125 total points
ID: 34873538
If you are using a popup form then nothing can access data on it because no code elsewhere can run until the popup form closes.
So you have to use code in the popup form to place the value where you want it.

So in the form_close event procedure of the popup you can do something like:

forms!mainformname!controlname= me.listboxname
0
 

Author Comment

by:ChuckRush
ID: 34874117
I was afrtaid of that. I wanted to use the popup window for several fields that reference that same data.  The Main form has several fields that contain an EmplID and i am showing an alphabetical list in the popup to allow a search on last name

Any ideas?
0
 

Author Comment

by:ChuckRush
ID: 34874980
OK the POPup works now wheni explicitily reference the ctl in the parent form. Is there a way that i can capture the current ctl i am on and pass it to the popup and use that to update the form in the parent after the selection?
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 125 total points
ID: 34877441
In the openform command you can pass the name in the Openargs parameter.

docmd.OpenForm "formname", ,,,,acDialog,"callingcontrolname"

Then when you pass the chosen value back you can use the controlname..

forms!mainformname.controls("callingcontrolname") = me.listboxname
0
 

Author Closing Comment

by:ChuckRush
ID: 34889390
Thanks Peter
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now