Results 1 to 2 of 2
  1. #1
    martinbanks is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    12

    Minor difference in SQL statement

    Hi all, I know this is just me being very picky and anal but I am genuinely interested in what is causing this problem.



    So I wanted organize my SQL statement like I do in WinSQL but for some unknown reason Access doesn't like it. Here is the one that doesn't work:

    Code:
         Me.cboProductSelector.RowSource = "SELECT tblProducts.PRODID, tblProducts.PRNAME " & _
                                                           "FROM tblProducts " & _
                                                           "WHERE tblProducts.PRCUSTID = " & Me.cboCustomerSelector & _
                                                           "ORDER BY tblProducts.PRNAME"
         Me.cboProductSelector = Me.cboProductSelector.ItemData(0)
    And here is the one that does work:

    Code:
         Me.cboProductSelector.RowSource = "SELECT tblProducts.PRODID, tblProducts.PRNAME FROM" & _
                                            " tblProducts WHERE tblProducts.PRCUSTID = " & Me.cboCustomerSelector & _
                                            " ORDER BY tblProducts.PRNAME"
         Me.cboProductSelector = Me.cboProductSelector.ItemData(0)

    I really can't see why it considers them to be different. Do I misunderstand the & _ concatenation?

    The second one gives me all of a customer's products in cboProductSelector and the first one gives me nothing

    Thanks all,
    Mart

  2. #2
    martinbanks is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    12
    HAhaha I guess sometimes it just helps to ask because I see the problem now

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

Similar Threads

  1. Do OS make a difference ?
    By Trojnfn in forum Access
    Replies: 7
    Last Post: 07-24-2012, 03:28 PM
  2. Replies: 3
    Last Post: 07-20-2012, 11:41 AM
  3. Get difference of Min and Max
    By nazimscr in forum Queries
    Replies: 1
    Last Post: 07-14-2012, 02:04 PM
  4. Mark the difference
    By zhshqzyc in forum Access
    Replies: 1
    Last Post: 01-28-2011, 08:49 AM
  5. Time difference
    By jguidry in forum Programming
    Replies: 1
    Last Post: 11-15-2008, 12:41 PM

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