From: Maarkr on 16 Mar 2010 10:50 Mistake #1 Thought I'd improve on this process: A user goes to select their name from a combo, but it's not in the list, so I have a button that opens a User entry pop-up form to add their name. They close the entry form and now must select their name from the combo. I want to dump the user entry form name into the combo when they close the user entry form so they don't have to select it. My problem is loading the new ID into the combo so the query can run from the combo data. The row source bound column is MbrID, with the second column being LFName. I've tried different approaches, including looking up the MbrID but the query still couldn't find it. If I lookup the MbrID, it loads it as LFName. Here's the latest which doesn't work: Private Sub CmdReturn_Click() Dim stUser As String stUser = Me.LFName 'from user entry form DoCmd.Close acForm, "name entry form" Forms!TrainingMain!Combo33.Requery Forms!TrainingMain!Combo33 = stUser 'this puts the user name in the combo, but I also need the combo to load the MbrID End Sub
From: Jeanette Cunningham on 16 Mar 2010 17:09 You can use the unload event of the popup to set the combo to the mbrID. Private Sub Form_Unload() If Not IsNull(Me.MbrID) Then Forms!TrainingMain!Combo33.Requery Forms!TrainingMain!Combo33 = Me.MbrID End If End Sub Private Sub CmdReturn_Click() DoCmd.Close acForm, "name entry form" End Sub Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia "Maarkr" <Maarkr(a)discussions.microsoft.com> wrote in message news:980149AF-E519-49D4-9526-47773117F8AE(a)microsoft.com... > Mistake #1 Thought I'd improve on this process: A user goes to select > their > name from a combo, but it's not in the list, so I have a button that opens > a > User entry pop-up form to add their name. They close the entry form and > now > must select their name from the combo. > I want to dump the user entry form name into the combo when they close the > user entry form so they don't have to select it. My problem is loading > the > new ID into the combo so the query can run from the combo data. The row > source bound column is MbrID, with the second column being LFName. I've > tried different approaches, including looking up the MbrID but the query > still couldn't find it. If I lookup the MbrID, it loads it as LFName. > Here's the latest which doesn't work: > > Private Sub CmdReturn_Click() > Dim stUser As String > stUser = Me.LFName 'from user entry form > DoCmd.Close acForm, "name entry form" > Forms!TrainingMain!Combo33.Requery > Forms!TrainingMain!Combo33 = stUser > 'this puts the user name in the combo, but I also need the combo to > load > the MbrID > End Sub
From: Jeff Boyce on 16 Mar 2010 17:17 As an alternate approach, check Access HELP re: NotInList and LimitToList. You can use this event and property to have Access pop open the new name form, then re-load the combobox with the newly-added name. -- Regards Jeff Boyce Microsoft Access MVP Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "Maarkr" <Maarkr(a)discussions.microsoft.com> wrote in message news:980149AF-E519-49D4-9526-47773117F8AE(a)microsoft.com... > Mistake #1 Thought I'd improve on this process: A user goes to select > their > name from a combo, but it's not in the list, so I have a button that opens > a > User entry pop-up form to add their name. They close the entry form and > now > must select their name from the combo. > I want to dump the user entry form name into the combo when they close the > user entry form so they don't have to select it. My problem is loading > the > new ID into the combo so the query can run from the combo data. The row > source bound column is MbrID, with the second column being LFName. I've > tried different approaches, including looking up the MbrID but the query > still couldn't find it. If I lookup the MbrID, it loads it as LFName. > Here's the latest which doesn't work: > > Private Sub CmdReturn_Click() > Dim stUser As String > stUser = Me.LFName 'from user entry form > DoCmd.Close acForm, "name entry form" > Forms!TrainingMain!Combo33.Requery > Forms!TrainingMain!Combo33 = stUser > 'this puts the user name in the combo, but I also need the combo to > load > the MbrID > End Sub
|
Pages: 1 Prev: IIF Function error in Access 2003 Next: cannot create New Record (icons greyed out) |