Peter Bellamy
Registered User.
- Local time
- Today, 15:54
- Joined
- Dec 3, 2005
- Messages
- 295
I know that Dlast DFirst etc do not always return the first and last record if you use them on a table, but they are supposed to work on a query that has been sorted.
However I have one that doesn't!
There are 3685 records all shown in the correct order when I view the query but the DLast command consistantly comes back with it the 3430th line ??
The code is 'constructed' to enable different buttons to provide the keywords that the 'GetRecords' routine requires.
Thanks
However I have one that doesn't!
There are 3685 records all shown in the correct order when I view the query but the DLast command consistantly comes back with it the 3430th line ??
The code is 'constructed' to enable different buttons to provide the keywords that the 'GetRecords' routine requires.
Thanks
Code:
Private Sub Command17_Click()
On Error GoTo Err_Command17_Click
'Stop
tablename = "QryAndrewsCWH"
tableshname = "andrews"
prodname = "CWH"
Me.customr = "Andrews"
GetRecords
tablename = "Andrews CWH"
StartSerialNo.SetFocus
Exit_Command17_Click:
Exit Sub
Err_Command17_Click:
MsgBox Err.Description
Resume Exit_Command17_Click
End Sub
Public Sub GetRecords()
SNo = tableshname & "_serialno"
prod = tableshname & "_product_type"
proddate = tableshname & "_date"
PackDate = tableshname & "_date_stock"
Tester = tableshname & "_tester"
invoice = tableshname & "_invoice_no"
Notes = tableshname & "_notes"
cust = tableshname & "_customer"
Me.firstsno = DFirst(SNo, tablename, "[" & tableshname & "_customer] = '" & Me.customr & "'")
Me.firstprod = DFirst(prod, tablename, "[" & tableshname & "_customer] = '" & Me.customr & "'")
Me.firstdate = DFirst(proddate, tablename, "[" & tableshname & "_customer] = '" & Me.customr & "'")
Me.lastsno = DLast(SNo, tablename, "[" & tableshname & "_customer] = '" & Me.customr & "'")
Me.lastprod = DLast(prod, tablename, "[" & tableshname & "_customer] = '" & Me.customr & "'")
Me.lastdate = DLast(proddate, tablename, "[" & tableshname & "_customer] = '" & Me.customr & "'")
Me.number = DCount(SNo, tablename, "[" & tableshname & "_customer] = '" & Me.customr & "'")