UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> List Box Question    
 
   
Gadawg
post Dec 28 2010, 01:34 PM
Post #1

UtterAccess Addict
Posts: 174



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?
Go to the top of the page
 
+
theDBguy
post Dec 28 2010, 01:54 PM
Post #2

Access Wiki and Forums Moderator
Posts: 48,114
From: SoCal, USA



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...
Go to the top of the page
 
+
Gadawg
post Dec 28 2010, 02:12 PM
Post #3

UtterAccess Addict
Posts: 174



Thanks, I'll give it a try.
Go to the top of the page
 
+
theDBguy
post Dec 28 2010, 02:13 PM
Post #4

Access Wiki and Forums Moderator
Posts: 48,114
From: SoCal, USA



(IMG:style_emoticons/default/yw.gif)

Let us know how it goes...
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 26th May 2013 - 03:27 AM