Increment textbox for Each Record (1 Viewer)

Norstar2

Registered User.
Local time
Today, 02:17
Joined
Mar 31, 2006
Messages
43
I have a form that I need to increment a textbox for each record in the table.

I have a table that lists problems that arise during production, and I just need to give them a number on the form via an unbound textbox. It seems like a very simple operation, but I can't figure it out! Maybe I am just thinking about it too hard :confused:

For Example, if there were 2 problems, I want my output to look like this.

Number Cause
1 Broken Gasket
2 Busted Shaft


If there were 3 problems, I'd like it to look like this:

Number Cause
1 Slimy Gear
2 Ran outta Oil
3 Forgot to turn on the power


Thanks!
 

rborob

Registered User.
Local time
Yesterday, 23:17
Joined
Jun 6, 2006
Messages
116
cant you use a recordset to find the number of records in a table using Count()
then increment this value. alternatively use a combo box that has a MAX statement as a row source then just reference this value and increment it?
 

Norstar2

Registered User.
Local time
Today, 02:17
Joined
Mar 31, 2006
Messages
43
How exactly would I set my unbound txtbox to do that? If I use =Count, it gives me the total count of the records. I want it to number each one in order (Ex: 1,2,3). =Count() shows (Ex: 3,3,3).

Maybe I am not understanding what to do.
 

rborob

Registered User.
Local time
Yesterday, 23:17
Joined
Jun 6, 2006
Messages
116
is it just the number yout need to increment?

say you had 15 rows in the table, you'd want the textbox to show 16?

why not use =Count+1

i suppose you could open a recordset and loop through gathering the names and adding them to a string. then just add the string to the textbox.
 

Norstar2

Registered User.
Local time
Today, 02:17
Joined
Mar 31, 2006
Messages
43
I have the textbox in the Details section of the continuous form. I want it to show what number record that is. I just need it to put a number beside each record.

For example, in my table I have 3 results for a particular query:

blue
red
green

What I want is to use this query on a form and place a number in front of each. To show this output:

PHP:
txtNumber     txtResult
       1          blue
       2          red
       3          green

Now if there were 5 results for the query:

purple
yellow
orange
blue
green

I would want the output to look like this on my form:

PHP:
txtNumber    txtResults
       1         purple
       2         yellow
       3         orange
       4         blue
       5         green


I figured there was some built in function to do this automatically, but I haven't been able to find it!
 

Users who are viewing this thread

Top Bottom