Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2011
    Location
    Huntsville, AL
    Posts
    4

    Unanswered: Access 2010 Next Record problem

    I have poured hours into attempting to resolve this issue, but have experienced no luck! All suggestons I have been able to find have been fruitless, so I appeal here...to you.

    My wife runs a consignment business and uses Access to track sales, profit shares, etc. It is her cash register and her checkbook. We have a form used forchekout that has several fields...one is autogenerated Order Number (OrderID), and another is Customer Name (Name). Both are held in the same table...OrderID is the primary key. My wife wants a next and previous record button to navigate by Order ID. That seemed simple & out of the box doCmd.gotorecord,,acnext.

    When I invoke the VB by clicking the arrow, the form transitions to the next record, but does so by alphabetized "Name." We want it to go to the next record based on the numerical "OrderID." I have tried a handful of things, including SetFocus, and have dumped hours into manipulating gotorecord syntax with no joy. Worthy to mention--when I Find/Replace (CTRL-F), the default Look In is Name. Seems related, but perhaps not.

    I'm at my wit's end for such an outwardly simple task. Any good suggestions?

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    This must be because the data set of your form is sorted on the "Name" field and not on the "OrderID" field. Check:
    - Is OrderID actually defined as the primary key of the table?
    - What's the RecordSource property of the form?
    - What are the OrderBy and OrderByOn properties of the form?
    Have a nice day!

  3. #3
    Join Date
    Mar 2011
    Location
    Huntsville, AL
    Posts
    4
    - Is OrderID actually defined as the primary key of the table? Yes.

    - What's the RecordSource property of the form?
    SELECT Orders.OrderID, Orders.OrderDate, Orders.Name FROM Orders;

    - What are the OrderBy and OrderByOn properties of the form?
    [_Orders].[Name]

    Bingo—Changed the Order By property to [_Orders].[OrderID], and we have a winner. Thank you so much for putting an quick end to the hours I have spent combing through this form!

Posting Permissions

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