range number

referee

Registered User.
Local time
Today, 07:22
Joined
Aug 21, 2003
Messages
38
hi

on my form i have a field registrationdate and person
the table has only 12 records
how can i have (continouis form) a field next to registrationdate
that show the range number on the form

example:
1/10/2004 15:00:00 = 1
1/10/2004 15:03:00 = 2
etc......
SO TO 12 RECORDS
when a record is changed te rangenumer on the form must always updated

thanks
 
Task . Query without MEMO and OLE fields.
Lets say we have query MyQuery with field MyField. In query you may have other fields which can use predicate DISTINCT. MyQuery can be sorted or unsorted.
We need to build a query which will not change the order of the fields but will add calculated field Num which will represent the record number in MyQuery, starting from 1.
Solution.
SQL of the query:
SELECT DISTINCT Numeration(MyField) As Num, MyField FROM MyQuery WHERE Numeration() = 0;

as you see in the query is used function Numeration. this is how it is build:

Public Function Numeration(Optional var) As Long
Static n As Long
If IsMissing(var) Then
n = 0
Else
n = n + 1
End If
Numeration = n
End Function

Comments 1. query is optimized by the sql so the value of the function in WHERE part which is independent from the query fields is calculated only once. This is used to set the initial value for sequential numeration

Comment 2. Predicate DISTINCT is used to convert the dinamic query to static . (In dinamic query it doesn't work.) Its direct role Distinct predicate is not used in this case as every record becomes unique of the enumeration although it prevent usage the MEMO and OLE fields.
You can convert those fields to the String type using Mid(Field_MEMO_OLE,1). As result there will be no conflict , but OLE field will lose it functionality. if you have only MEMO fields, then such approach can be used.

In fact you don't need this "Comments" stuff but just for the future reference.
 
thx for this help it works fine now

thank you

greetings
 

Users who are viewing this thread

Back
Top Bottom