Text box that addItion repeating numbers from a field from a table (1 Viewer)

DreamerArgentino

New member
Local time
Today, 11:53
Joined
May 19, 2018
Messages
26
Hi everyone!

I ask you a question. I have the following data:

TABLES:

'TABLE1' with a 'FileID' field (autonumeric) and another 'Nro-NA' (Numeric)
'MAIN' with an 'ID' field (Autonumeric)

I need the following:

Make a 'Text Box' (TextBox1) in the MAIN form (data of the table with the same name) that ADDITION and shows in each record of the form (ID field), how many times each number is repeated in the field 'Nro-NA 'from table' TABLE1 '

Example: For record 1 of the ID field of the MAIN form, add in the 'TextBox1' text box how many times a number appears in the 'NA-No' field and for the case of no. 8, it would be a value of 2, because it appears 2 times ...

NOTE: I have managed to get it to work, but with a textbox inside a subform, I would like to place it on the main form, but I have not managed to generate a working expression to place in the RowSourse ...

I have used this expression: =Cuenta([RegID])


I hope I have explained myself

Thanks!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:53
Joined
May 7, 2009
Messages
19,246
your Main table is not needed though.
you create a query (Total Query):

select [Nro-NA], Count([Nro-Na]) From Table Group By [Nro-NA];

then show the query (you can even create a form (datasheet) from the query).
 

DreamerArgentino

New member
Local time
Today, 11:53
Joined
May 19, 2018
Messages
26
Hello arnelgp!! Thanks for reply!

Yes, I have tried to create a query, but what I was looking to do is a Independent TextBox inside the main form, containing that query or expression with the count, but not of all the records in the base, but only of those values of the field 'Nro-NA' that belong to the current record.

Thanks!
DreamerArg.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:53
Joined
May 7, 2009
Messages
19,246
if you have created the query, you can use Dlookup() to get the count of a specific Nro-NA.

on the textbox ControlSource:

=DLookup("[CountOfNro-NA]","theQuery","[Nro-NA] = '" & [Nro-NA] & "'")
 

DreamerArgentino

New member
Local time
Today, 11:53
Joined
May 19, 2018
Messages
26
if you have created the query, you can use Dlookup() to get the count of a specific Nro-NA.

on the textbox ControlSource:

=DLookup("[CountOfNro-NA]","theQuery","[Nro-NA] = '" & [Nro-NA] & "'")
Hello arnelgp!!

Excuse my lack of knowledge, let's see if I understand:

"theQuery" It is the query that I already have generated with the Count
"Nro-NA" It is the field of TABLE1 on which you are calculating

but...

[CountOfNro-NA] what would it be? the name TextBox? 😟


---------------------------------------------------------------------
UPDATE:

Anyway I have tried and it always gives me the following error (mine is the one in Spanish)
1637950317513.png

1637950393866.png

I use the Spanish version, I don't know if it has to do with that

Thanks a lot!
 
Last edited:

Users who are viewing this thread

Top Bottom