Results 1 to 2 of 2
  1. #1
    accesshelpme is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    18

    pick listbox item to open specific record

    SO i have a list box that fills based on the following code.....
    Dim strSQL As String
    strSQL = "SELECT Products from [Client ProdVend] " & _
    "Where Client_Account_Name = '" & Me.Client_Account_Name & "'"
    Me.List91.RowSource = strSQL
    Dim strSQL As String
    strSQL = "SELECT Products from [Client ProdVend] " & _
    "Where Client_Account_Name = '" & Me.Client_Account_Name & "'"
    Me.List91.RowSource = strSQL

    There is another field in the [Client ProdVend] table called ID. I want to be able to select a product in the listbox, but have that selection open up a form based on the ID field associated with that product. Right now i use this.



    DoCmd.OpenForm "ProductDetailsEditor", , , "Products='" & Me.List91 & "' AND Client_Account_Name='" & Me.Client_Account_Name & "'"

    The Problem is if there are multiple products with the same name, instead of going to the specific instance of the product(cased on the ID)...it just opens all of the products with that name up, starting with the first one.....

    Can anyoen help me have it only show the specific record?...thanksss

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I see a couple things that xhould be fixed (or changed), but it is your database. Soooo....

    Try this:
    Code:
    Dim strSQL As String
    strSQL = "SELECT ID, Products from [Client ProdVend] " & _
    "Where Client_Account_Name = '" & Me.Client_Account_Name & "'"
    Me.List91.RowSource = strSQL
    Don't forget to set the list box:
    Column count = 2
    column widths = 0";1"


    And to open the form:
    Code:
    DoCmd.OpenForm "ProductDetailsEditor", , , "ID = " & Me.List91

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

Similar Threads

  1. Open form on specific record
    By iky123 in forum Forms
    Replies: 1
    Last Post: 04-11-2012, 09:56 AM
  2. Open form to specific record
    By Two Gun in forum Forms
    Replies: 7
    Last Post: 11-09-2011, 10:00 AM
  3. Open form to a specific record from a query
    By chris.williams in forum Forms
    Replies: 11
    Last Post: 10-06-2011, 04:15 PM
  4. Open Specific Record
    By halfaguava in forum Forms
    Replies: 1
    Last Post: 06-09-2011, 04:08 PM
  5. Open Form to Specific Record
    By batowl in forum Forms
    Replies: 1
    Last Post: 04-08-2011, 10:10 AM

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