Page 1 of 4 123 ... LastLast
Results 1 to 15 of 55
  1. #1
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo Box - List Box (2000)

    I have a combo box cmbName, it's row source is SELECT tblEmployee.emp#, tblEmployee.last name & " " & tblEmployee.first name AS FullName, tblEmployee.first name, tblEmployee.last name FROM tblEmployee WHERE tblemployee.principal Like -1 ORDER BY tblEmployee.last name & " " & tblEmployee.first name;
    Now what I want to do is have the name selected, determine which names are displayed in the list box. The list box has a query as it's row source. In the query, I have the correct fields added and the criteria set for the Name. The criteria is Forms!frmApproval!cmbName.column3. That is the correct name I need to have run the query. Only when I requery the list box, it pops up a box asking what the column3 value is instead of getting it from the combo box. How do I make it look at the combo box.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box - List Box (2000)

    Column3 is not valid. Try Column(3) instead.

  3. #3
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box - List Box (2000)

    Still get a little box asking what column(3) is. Any more suggestions?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box - List Box (2000)

    Did you use Forms!frmApproval!cmbName.Column(3) ?

  5. #5
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box - List Box (2000)

    Yes, it also has brackets around the form and form name, but those didn't show up.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box - List Box (2000)

    I don't think we can solve this without seeing the form and query. Could you post a stripped down copy of the database? See <post#=401925>post 401925</post#> for instructions.

  7. #7
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box - List Box (2000)

    I have attached a stripped down version. What you should do is open the file type in Adler in the box. Then select Orsburn in the combo box. You will then have to type in Orsburn in the next box that pops up, that is what I want to eliminate.
    I also have a afterupdate procedure on the combo box to requery the list box. Do I need this? I think it might be causing access to crash sometimes.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box - List Box (2000)

    I don't understand why you have a separate tblPrincipals. All "bosses" should be in tblEmployees, with the Principal field set to Yes. The Boss field in tblEmployees should not contain the last name of the employee's principal, but the Emp# of the principal. That makes the structure a lot simpler, and you can refer directly to the combo box.

    Yes, you do need to requery the list box. It shouldn't cause Access to crash if things are set up correctly.

    See attached modified version (I removed two tables and a report that are not needed for this thread.)

  9. #9
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box - List Box (2000)

    Thanks alot Hans. I don't know why I made a principal table. Must of lost my mind that day. I got all that straightened out. Is there a way to make an item in the list box a link to a form?

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box - List Box (2000)

    You can use the On Click or On Dbl Click event of the list box to open a form, if that is what you want. I would prefer the On Dbl Click event.

  11. #11
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box - List Box (2000)

    Can I have a separate event for each item in the list?

    Also, I added a textbox at the top with control source DatePart("ww",Now()). I want to increment that by 1 when I click btnInc. I get an error when say me.txtWk = me.txtWk + 1.

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box - List Box (2000)

    You can pass the item selected in the list box to the form being opened to filter it. Otherwise, I don't understand what you mean by "Can I have a separate event for each item in the list?".

    You cannot change the value of a calculated control manually or in code. Instead of setting the Control Source to =DatePart("ww",Now()) you can leave the Control Source blank, and set the Default Value property to DatePart("ww",Now()). This makes the text box unbound, and you will be able to change its value in code.

  13. #13
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box - List Box (2000)

    When I dbl Click on the name in the list, I need to use that name in my query.

    here is what I have right now: form!frmLogin!cmbEmpName = me.lstApprovalNames.Selected
    I get an error that says arguement not optional.

    Here is what I need it to do. I have a form that is based on a Query. The query is based on what is in frmLogin!cmbEmpName and frmCalendar!txtWkNo.
    I need these values to be put into the query from the list box.
    Let me know if you need a stripped version of the database.

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box - List Box (2000)

    Can't you just use Me.lstApprovalNames? You only need the Selected collection if the user can select multiple items in the list box.

  15. #15
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box - List Box (2000)

    When the user clicks on a name, I want it to open my form and run the query with their name. So each different name will run a different query.

Page 1 of 4 123 ... LastLast

Posting Permissions

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