• Select Name on 1 form, use that name on another (2

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Select Name on 1 form, use that name on another (2

    Author
    Topic
    #437421

    I have a form with a listbox of people on it. I want to be able to double-click a user and have that user’s name set into a field on another form.

    This application is multi-user, and I’ve never used global variables so I don’t know how they would react in a multi-user environment.

    What is the best, easiest way to accomplish this? I already have the name from the double-click, it’s just the new form piece I am struggling with.

    Thanks!

    Viewing 0 reply threads
    Author
    Replies
    • #1039789

      Global variables are unique to the user, so that isn’t an issue.

      Lacking any other information, and having to make alot of assumptions, you can do what you say with a line of code in your listbox’s Double Click event. Let’s assume listbox name is lstNames:

      Forms!ThatOtherForm!txtName = lstNames

      • #1039790
            intSelectedDelivery = Me.lstEmployees.Value
            DoCmd.OpenForm "frmDeliveryMonitor"
            Forms!frmDeliveryMonitor!cboEmployee = intSelectedDelivery

        I tried this, but the other form’s cbobox remains blank.

        Is the fact that the form is not open a problem?

        • #1039792

          It’s the combo box that is the problem.

          I can set a textbox correctly, but not the combo box.

          Any suggestions?

          • #1039798

            This goes back to all the assumptions I had to make. You never specified what the originating listbox looked like, nor what the destination control was. I don’t even know what you are trying to “move”. The bound column for the listbox and the cbobox need to be the same; that is, same field from underlying queries.

            • #1039799

              The bound column for the receiving cbobox is an integer. I can type the number in the cbobox…why can’t I set it via code?

            • #1039802

              What is the bound column for the listbox?

            • #1039807

              I’ve attached a stripped down version…

              Open frmMain and click relink tables.

              Then open frmDelivery. Double-clicking someone in the list box should open the frmDeliveryMonitors and populate the Employee combobox at the top.

            • #1039809

              Your problem (as I suggested before) is that the bound columns aren’t the same! You have EmployeeID as bound column in listbox, but ID is bound column in combobox! Change the bound column to column 2 (the Employee ID).

            • #1039810

              I owe you a huge apology. I forgot that the ID was included in the source and thought it was bound to EmployeeNumber.

              Thank you for helping me and please accept my apology. Next time, I’ll triple check!

            • #1039819

              That’s OK. It’s not like we all haven’t made this same mistake a few times ourselves.

    Viewing 0 reply threads
    Reply To: Select Name on 1 form, use that name on another (2

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: