Results 1 to 4 of 4
  1. #1
    Phred is offline Competent Performer
    Windows XP Access 2010 (version 14.0)
    Join Date
    Dec 2009
    Posts
    246

    Cool Pull multiple combobox values into separate vb variables


    VB skill livel moderate.

    I have a combobox that pulls three values:
    ItemName, Cost, LowestPriceVendor.
    ItemName is bound column.

    I know how to pull ItemName into VB as a variable in the after update event.

    What I don't know is how to pull the other two values into VB as seperate variables so I can reuse them

    I can't seem to figure out the right syntax.

    Here is my combobox select statement. It works fine.

    SELECT [Qry_SelectAlternateItem].[ItemName], [Qry_SelectAlternateItem].[PriceperUnit], [Qry_SelectAlternateItem].[LowestPriceVendor] FROM Qry_SelectAlternateItem ORDER BY [ItemName];

    In VB I can do the following, pop it in a variable, and get the ItemName.

    Forms!Sub_Frm_Modal_EditScheduledMeal!CmbSelectAlt Item.SetFocus
    stAltItm = Forms!Sub_Frm_Modal_EditScheduledMeal!CmbSelectAlt Item.Text

    Thanks,

    Phred

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    This should help (you want the Column property):

    http://www.baldyweb.com/Autofill.htm

    By the way, you won't need the SetFocus line if you drop .Text from the next line. .Value is the default, and it's what you want anyway.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Phred is offline Competent Performer
    Windows XP Access 2010 (version 14.0)
    Join Date
    Dec 2009
    Posts
    246
    This is a beautiful thing. It is solved. And thanks for the help on the other item. I just put it into action.

    Many thanks, Phred

    stCatID = Forms!Frm_countsparent!CmbPickCat.Column(0)
    stPickCat = Forms!Frm_countsparent!CmbPickCat.Column(1)
    stSiteId = Forms!Frm_countsparent!CmbPickSite.Column(0)
    stSiteName = Forms!Frm_countsparent!CmbPickSite.Column(1)
    stYear = Forms!Frm_countsparent!PickYear.Column(0)
    stMonth = Forms!Frm_countsparent!PickMonth.Column(0)

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query can't pull parameter from combobox
    By testsubject in forum Queries
    Replies: 3
    Last Post: 03-08-2011, 11:26 AM
  2. Replies: 3
    Last Post: 11-24-2010, 06:33 PM
  3. Replies: 5
    Last Post: 06-10-2010, 05:46 PM
  4. multiple fields in separate records
    By Fredo0709 in forum Database Design
    Replies: 9
    Last Post: 04-09-2010, 12:23 PM
  5. Replies: 0
    Last Post: 12-19-2006, 09:44 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums