Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get the first in the row 1

Status
Not open for further replies.

canett

Technical User
Jan 22, 2006
18
BG

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.AddNew
rst!Customerid = lngCustomerID
lngOrderID = rst!OrderID
rst.Update
 
Something like this ?
Dim lngCustomerID As Long
lngCustomerID = Nz(DMin("CustomerID", "Customers"), 1)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top