Solved Finding specific Record index

Rashid

Member
Local time
Yesterday, 16:09
Joined
Sep 6, 2019
Messages
36
RecID(autoNo)StuIDStuNameData
11aDr
22bCr
31aCr
41aCr
52bDr
In a Continuous Form

I Need when I select recid4; a textbox (unbound)

Show me “This is 3rd Transaction of this student”

So what code will be applied in unbound tex
 
For example, on Form_Current event

msgbox("This is " & dlookup("count(*)","table_name","StudID=" & me!StudID & " and RecID<=" & me!RecID) & " transaction bla bla bla...")
 
Last edited:
I think you need to use a ranking query grouped by student and sorted by the RecID to get what you need:

Cheers,
 
For example, on Form_Current event

msgbox("This is " & dlookup("count(*)","table_name","StudID=" & me!StudID & " and RecID<=" & me!RecID) & " transaction bla bla bla...")
Not working ,,,,
 
Because you want an index or rank, not a total count; have you tried to use my link?
 
Not working ,,,,
After googling i have got the solution and That is:- Creat a query add a new column RecNo with this Code: RecNo: DCount("transid","feetable query","transid<" & [transid] & "AND STUDENTID=" & [STUDENTID])+1 and in the form in which i need the value place a unbound textbox with the code: dlookup("Recno","QueyName","transid="&[transid]). It Is working great.No Body Give this solution in this forum.????
 
Because it is similar to the approach used in Allen's link I provided you in post #3 (but potentially slower with large record sets because you are using dCount instead of Count in a totals subquery). but you ignored it....
Anyway looks like you learned something new and maybe next time a similar question comes in maybe you can jump in to help.
Cheers,
 
No Body Give this solution in this forum.????

Maybe because it's not the simplest solution
Could you please tell me what was wrong with the recommended code?

dlookup("count(*)","table_name","StudID=" & me!StudID & " and RecID<=" & me!RecID)


1670058344061.png
 

Users who are viewing this thread

Back
Top Bottom