Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005

    Unanswered: Get the first in the row

    In the part of the code shown below, is it possible for the constant LngCustomer to get the fist number of the customers in the table Customers
    for example, if the first customerid = 4000, then to get LngCustId = 4000

    Const lngCustomerID = 1

    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim lngOrderID As Long
    Dim strSQL As String
    On Error GoTo ErrHandler

    ' Create a new order and obtain its OrderID
    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("Orders", dbOpenDynaset)
    rst!Customerid = lngCustomerID
    lngOrderID = rst!OrderID

  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    Could you elaborate on "first" and it's relevance? If you're looking for the lowest customerid, then you could use a domain function:

    DMin("customerid", "tblYourTargetTable")

    Or SQL:

    SELECT TOP 1 customerid
    FROM tblYourTargetTable
    ORDER BY customerid ASC
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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