If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to pass a value to a popup.... again
I opened a popup form and then opened a dialog box from this popup. I
needed to enter information into a text field on the dialog box and then pass it back to another textfield in the popup. I have not been able to do this. I tried: Setting Control Rowsource Property on the Popup like this: =Forms![frmDialogBoxName]!txtFieldDialog That doesn't work. The value never passes from the DialogBox to the Popup. Next I tried: Creating a global variable and trying to set the control rowsource equal to that and that didn't work. Now I am trying to pass the handle like this: DoCmd.OpenForm "frmDialogBox", , , , , acDialog, Me.hwnd The only problem is how can I use this (the OpensArgs property) to reference the popup and pass a value back to it. I am a newbie to Access VBA and I know I am not understanding something here but I just don't get it. Why won't a txtBox value pass from a form to a popup. I can't find a way to "name" or call the popup from the dialog because using the name frmPopup doesn't work in the Dialog Box. Thanks. |
#2
|
|||
|
|||
You have two choices:
1) Pass the name of the form/control to the dialog form, and then have it set the value when the form closes. It is not clear if you need to design this "prompt" form for general use, or a specify form???? So, if you do the above, then don't even bother with a dialog form, but use a model form (they are complete different in use...while a dialog form is model...a model form is not dialog at all). So, assuming we JUST use a model form, then you can go: docmd.OpenForm "slkfj",,,,,,"MyFormName, MyFieldName" In the CoolPromptForm, in the on-load event, you can now go: strFormtoUpdate = split(me.OpenArgs,",")(0) strFieldToUpdate = split(me.OpenArgs,",")(1) (I of couse assume strFormToUpdate and strFieldToUpdate are defined at the module level for the CoolPromptForm) Then, in the forms on-close event, you simply go: forms(srFormToUpdate)(StrFieldToUPdate) = me.SomeTextBoxPrompt So, the real answer is not to pass data, but in fact simply pass a forms reference. You can even have the model form pick up the active form, and even the active field on the previous form..and thus not even pass any field refs if you wish. The 2nd approach is the old fashioned approach were you call a form, wait for response, and then the calling code continues and you grab the data. I explain how to do this he http://www.attcanada.net/~kallal.msn/Dialog/Index.html -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada http://www.attcanada.net/~kallal.msn |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
nested pass thru query problem | Tcs | Running & Setting Up Queries | 1 | August 18th, 2004 08:38 PM |
Tricky Little Popup Form Problem for You Experts | Tinker372 | Using Forms | 1 | August 6th, 2004 02:53 PM |
PASS or FAIL? | Param | Worksheet Functions | 5 | July 16th, 2004 10:55 AM |
How to run word and pass a mail merge values and fax it to the recipient | Belinda | Mailmerge | 2 | June 13th, 2004 12:49 AM |
Moving data from popup to subform | John Nurick | Database Design | 0 | May 6th, 2004 06:19 AM |