Pop up form and return values help please

  • Thread starter Thread starter Corey-g via AccessMonster.com
  • Start date Start date
C

Corey-g via AccessMonster.com

Hi All,

I have built a order entry form, and a have a button that pops up a 'search'
form. I read through a bunch of other posts about how to return the selected
value form the pop up, but I can't get it to work as suggested.

I think it was a response from Dirk, and he said that you open the form in
Dialog mode, then when the user selects the value you sent the visible
property to false -and this will allow the code to continue. This doesn't
seem to be the case... What I was hoping to set up was as follows:
The pop up form has 2 parts, the main form and a sub-form (in datasheet view).
The user selects a value from a combo box on the main form, which filters the
datasheet subform (This is working fine). What I was hoping to do was have
the user then double click on the result that htewanted, and have that value
returned into the field on the original form.

So far I have the original form working (as dialog), and when I click the
button to search, the form pops up fine. I can work with the combo box(es)
and filter the subform datasheet, but I can't get the value back.

Any thoughts, better design tips, or assistance would be appreciated.

Thanks,

Corey
 
Thanks for the reply David, but I don't see how 'Loading Images' has anything
to do with getting the value back from the pop up. Also, what is Access 2004
- I haven't heard of that?

While I was testing away after posting the question, I was able to get the
value of the clicked datasheet record (not back in the original form, but in
the pop up). So what I might do is have this set a value (variable) back on
the original form, then have the pop up close itself.

Not sure if this will work yet, but that's where I'm at so far.

Thanks again,

Corey
 
Since my last post, I have been able to set the value of the original form's
combo box with the user selected value from the pop up. The issue is now
that I can't get the event that was supposed to fire (after update) to fire
this way (yet - I will begin testing it now). So althought the right value
is set, all of the other fields that get set based on this value aren't
getting updated (unless I click on the combo box again after and select the
'selected' value).

Corey
 
Just to finish this thread off, I figured out how to accomplish what I wanted.

Way too easy, just didn't think of it, but what I learned will help again I'm
sure.

By passing back the selected value, then having the next line of code after
calling the pop up (in dialog mode) call the after_update event of the contol
makes everything work as expected. Can't believe I couldn't think of 'Call' -
sometimes I guess I over complicate things in my mind, and then struggle with
how to implement.

So, to recap:
1) button click to open pop up form
docmd.openform "myPopupForm", acNormal, , , acFormEdit, acDialog ' Key
here is acDialog !!!
2) do what ever it is you wanted with the pop up (filter records, do
calculations, etc...)
3) When finished, have the pop up set the value of the original form
[Forms]![Main Form Name]![Sub Form Name if present]!Control_Name = Me.
[pop up control].Value
4) Close the pop up form
5) As the form was opened as a Dialog - the code stops until form is closed.
The line immediately following the docmd.open form in step 1 has:
Call myControl_after_update

Voila - everything completes as desired.

Hope this helps others...

Corey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top