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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want a record number text box beside each record

Status
Not open for further replies.

DanEaton

Technical User
Jun 24, 2002
60
CA
On my search form, my search results are in the detail of a continuous form. I want a text box to show the currentRecord beside each record. I tried to make a text box called txtCounter that would show this results. I put this in as the control source:

=[Me].[CurrentRecord]

This did not work. I tried some code that was supposed to make it work, but did not...I'm kinda stuck. Any help would be great.

-Dan Dan Eaton
deaton@caemachinery.com
 
Dan,
You don't need the "=me.[currentrecord]"
just the fieldname.
control source [currentrecord]
Or just drag the field from the field list to the form.
jim
 
Dan
I have also been trying to get the answer to this problem, sofar without sucess, did the above work for you? I originally tried [Recordcount] but with no luck.

It seems such a silly and obvious problem to resolve and yet no straight forward answer

 
No, nothing has worked, some people have been a great help by giving me code that was basically a compromise that just never really worked correctly. I have giving up as of now. But if you find something, drop me aline, I would be most grateful.

I figured that it must have something to do with the currentRecord method...But, no one has ever mentioned it to me. What I was saying above, was that I tried to use Me.CurrentRecord as the control source, I think xaf294 thought that I was confused about controls in general..Maybe you might wanna try that path (CurrentRecord is the thing on the bottom of the screen that tells you what record you are at). Dan Eaton
deaton@caemachinery.com
 
Dan

If I get the answer to this I will let you know.

I have kept this posting flagged
 
Hi,
Try the following:

* Place an unbound text box in the Detail section.
* Set its Control Source property to =1
* Set its Running Sum property to Over Group

Hope this helps. Let me know what happens.

With regards,
PGK
 
If you JUST want a counter, PGK's soloution will accomplish it. But only at the expense of additional trouble later on, as you will need to explain that the counter is not a useful reference to a record which your 'customers' will use to ask questions about the record being displayed. If you want a true record pointer, you will need to create such a value in the underlying table(s) and simply display it on the report.

"CurrentRecord" is available only in Forms, and is just the same "Number" you can (would) see in the record selector box at the bottom of the screen. RecorCount 'SHOULD' only be a single value which represents the total number of records in the recordset, although it may contain different values depending on the context.

For both of you, I would generally advise against the display of 'arbitrary' values in either forms or reports. They take up 'real estate'; cause confusion between the users, customers, programmers and analysts; require additional explanation (and / or documentation); and are simply useless.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Where can I find this property? Is it the case that it is only used in reports? If so, this may be a problem as I need one in a continuous form. Dan Eaton
deaton@caemachinery.com
 
Hi,
I have used it only in reports but not in continuous forms. The property can be foun under the Data tab of the properties sheet for the text box. Try and let us know what happened.
With regards,
PGK
 
MichaelRed

The counter is only proposed to be an Item count and used in the correct scenario should not cause us any user context problems, I agree that generally unique references should be put in the underlying table and used accordingly.

CurrentRecord does not appear to work within a Continous form environment. It always returns '1'

PGK
The running sum property only applies in Report objects (unless I'm missing something there does not appear to be any equivalent within Form objects)

Thanks to you both, but I fear the answer is still elusive.

 
One way to do it-but is applicable only in certain cases-is to use DCount in a calculated field of the recordsource.

DCount(&quot;Items&quot;, &quot;TableOrQuery&quot;, &quot;Identifier < &quot; & [Identifier])

where Items is whatever field from TableOrQuery and Identifier is a unique identifier for the records (numeric or date). Moreover, the recordset must be sorted ascending by Identifier and any filter applied on the form would have to be inserted in the condition of the DCount.

Something else: if the recordset is large, you may have to go and shave before the form is fully populated.
Tried it myself some time ago, but luckily I convinced the customer to give it up!
This is just one of those unnecessary bells and whistles...

Dan
[pipe]
 
Dan
Thanks for this, the recordset is quite large so I will take your word for the speed of population, maybe you could even grow a beard rather than shave it!

As you say, bells and whistles can be done without.
 
Thanks for all your input, I'm still looking for answers. I agree with PassingBy, having a number displayed in search results is not at all confusing in this context. It's simply display aesthetics for me. However, I'm at my last day of work, and the project is complete, so thanks for all of your help...The truth is out there (and I bet its basic in this case).

Peace,
Dan Dan Eaton
deaton@caemachinery.com
 
Hello:
Butting in...
There is a procedure to insert &quot;line numbers&quot; when displaying continuous records. It is found in MS' sample database 'FrmSmp00' (for Access2K). The same database has about 25 other gobbets of code and procedures that can be helpful. There is, I think, a similar sample for Access97 called 'FrmSmp97'. You can download this from Microsoft's support pages.
If I understand the question, that is. Gus Brunston [glasses] An old PICKer, using Access2000. I manage Suggestions welcome. padregus@attbi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top