Michael Brösdorf
michael.broesdorf at web.de
Thu Jul 31 05:27:02 CDT 2003
Andy, that's exactly what I need - thank you! Michael -----Ursprüngliche Nachricht----- Von: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]Im Auftrag von Andy Lacey Gesendet: Donnerstag, 31. Juli 2003 11:50 An: Access Developers discussion and problem solving Betreff: Re: [AccessD] Picklist Michael What I do is this (and I don't claim any originality for this). If the user presses Cancel I close the form. If he presses Ok I keep the form open but make it hidden. The calling form gets control back in both cases, so it tests for whether the form is open. If so it gets the value(s) off the screen and then closes it. Here's some code: DoCmd.OpenForm "frmWhatever", , , , , acDialog If IsScreenOpen("frmWhatever") = True Then var = forms![frmWhatever].txtControl DoCmd.Close acForm, "frmWhatever" End If Function IsScreenOpen(strName As String) As Boolean IsScreenOpen = (SysCmd(acSysCmdGetObjectState, acForm, strName) = acObjStateOpen) End Function and behind the Ok button is just Me.Visible=False -- HTH Andy Lacey http://www.minstersystems.co.uk --------- Original Message -------- From: "Michael Brosdorf" <michael.broesdorf at web.de> To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> Subject: [AccessD] Picklist Date: 31/07/03 09:42 Dear group, my application has a whole bunch of master data tables. I want to create a single form that allows me to pick one value from these master tables. So far, I pass OpenArgs to the form specifying from what master data table I want to pick a value. That works fine. The form basically consist of a listbox (to display the content of the specified master data table) , a textfield (to hold the ID of the selected entry), an OK- and a Cancel-Button. The form is opened as a dialog form (meaning it keeps the focus until it is closed). Now comes the problem: how do I get the selected value back to the calling form? (When the user clicks OK, the form is closed. So the calling form cannot read the value of the listbox or the textbox.) Has anyone done something like that and help me out? TIA, Michael ---------------------------------------------------------------------------- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030731/108aa6b8/attachment-0001.html>