From: Alan on 20 Apr 2010 01:40 I have a dialog that does a search and needs to return the search results to the calling function. Especially if the seach is cancelled or produces no result. When a result is produced, I can handle that by updating a control on the calling form, but unless I have hidden controls on the calling form, I can't return a cancelled or no find result. A return value would be handy if it exists, or can be created Thanks -- Alan Heiser
From: John W. Vinson on 20 Apr 2010 02:03 On Mon, 19 Apr 2010 22:40:01 -0700, Alan <Alan(a)discussions.microsoft.com> wrote: >I have a dialog that does a search and needs to return the search results to >the calling function. Especially if the seach is cancelled or produces no >result. > >When a result is produced, I can handle that by updating a control on the >calling form, but unless I have hidden controls on the calling form, I can't >return a cancelled or no find result. > >A return value would be handy if it exists, or can be created A Form doesn't return a value... but you can get it with a trick. Opening a form in Dialog mode pauses the calling code until the form is closed... *or becomes invisible*. Put a button on the dialog form (labeled Close, or Done, or whatever) that the user can click to terminate that form. Its click event should just do Me.Visible = False The calling code will then resume, and can refer to =Forms!dialogformname!controlname (or multiple controls, if appropriate) to retrieve the value(s). It should then explicitly close the (now invisible) form: DoCmd.Close acForm, "dialogformname " -- John W. Vinson [MVP]
|
Pages: 1 Prev: Selecting Printer Tray for Mail Merge Next: Making a combo box enable for two case |