I am working on a MS Access 2010 Database and I have a ODBC connection to a table. The table is setup as a linked table. I am using VBA to bring in some data for sales orders based on the shipment-id. The table that I am getting this information has all the line items for each order, so I get many lines for each order. I am trying to group the data so that I only get each order number once. However I am having some difficulty getting this to work. I don't understand why my query will not group the data. Here is my query syntax:
"SELECT HIS00SCH_SHIPFIL.HSHPNO, HIS00SCH_SHIPFIL.HSONUM " & _
"FROM HIS00SCH_SHIPFIL " & _
"WHERE HIS00SCH_SHIPFIL.HSHPNO = '" & strQryNbr & "' " & _
"GROUP BY HIS00SCH_SHIPFIL.HSONUM,HIS00SCH_SHIPFIL.HSHPNO;"
What am I doing wrong when I execure this? Thank you for you help!