Link to home
Start Free TrialLog in
Avatar of lee_jd
lee_jdFlag for Afghanistan

asked on

Fill a field using another field from another form

I have a data entry form.  One of the fields on the form needs to be selected from a predefined list.   I tried using a combobox to provide this but the list is too big.

Instead I created a search form that opens when the user clicks a command button next to the field on the data entry form.

When this new search form opens the user has the ability to search and select the record they want.   I need the ID selected to be passed back to the Data Entry form.

I have tried instantiating the search form as an oject using code below that is executed from the Data Entry form.

'----------------------------
Dim f As New Form_Search

f.Modal = True
f.Visible = True
 
If f.SelectedItem > 0 Then
'use  f.SelectedItem
End If

Set f = Nothing
'------------------------------------
The problem is that this code continues to run after f.visible = true.   What I really want is to hold the code until it is hidden so that I reference and use  f.selected item.

Any ideas?
SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lee_jd

ASKER

Search form
just wondering, how you can run codes from anywhere, when a form was open in dialog mode.
if the dialog form sets its own visible propery to false it is no longer 'dialog' and the calling code will resume, at whch point it can retrieve stuff from the hidden form