Full Version: List Box Question
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Gadawg
On my main form I have a text box control (Person1) to enter a person's name. I have it set to where when double clicked a second form (pop up) opens with a list box showing a list of persons names already entered. I have the double click of the list box as follows:

Forms!frmPropertyEntry!Person1= Me.lstPersons
DoCmd.Close acForm, Me.Name

After the selected name is double clicked it puts it in the text box control on the main form. It works fine. I now have placed a second text box control for a second person entry (Person2) and want to use the same function. What I want to do is use the same pop up form to enter data into several different controls and need help with the code? Any help is appreciated?
theDBguy
Hi,

Here's one possible approach:

1. In a Standard Module, create a public variable:

Public gtxtPersonName As Textbox

2. In the same Module, create a public function to open the popup form:

Public GetPersonName(txt As Textbox)

Set gtxtPersonName = txt
DoCmd.OpenForm "PopUpFormName"

3. In the Double-Click event of the Listbox:

gtxtPersonName = Me.ListboxName
DoCmd.Close acForm, Me.Name

4. In any form you want to use the PopUp form, use the following syntax:

GetPersonName(Me.Person1)

Hope that helps...
Gadawg
Thanks, I'll give it a try.
theDBguy
yw.gif

Let us know how it goes...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.