Results 1 to 11 of 11
  1. #1
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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!
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

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

    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
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select Name on 1 form, use that name on anothe

    <pre> intSelectedDelivery = Me.lstEmployees.Value
    DoCmd.OpenForm "frmDeliveryMonitor"
    Forms!frmDeliveryMonitor!cboEmployee = intSelectedDelivery</pre>


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

    Is the fact that the form is not open a problem?
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  4. #4
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select Name on 1 form, use that name on anothe

    It's the combo box that is the problem.

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

    Any suggestions?
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  5. #5
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Select Name on 1 form, use that name on anothe

    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.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  6. #6
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select Name on 1 form, use that name on anothe

    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?
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  7. #7
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Select Name on 1 form, use that name on anothe

    What is the bound column for the listbox?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  8. #8
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select Name on 1 form, use that name on anothe

    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.
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  9. #9
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Select Name on 1 form, use that name on anothe

    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).
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  10. #10
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select Name on 1 form, use that name on anothe

    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!
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  11. #11
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Select Name on 1 form, use that name on anothe

    That's OK. It's not like we all haven't made this same mistake a few times ourselves.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •