I have an Access 2003 form (frmCompanies) with a continuous sub-form (frmDepartments)
I need a row number (sequential: 1, 2, 3, etc.) for each record displayed int he continuous form.
I have found an example of how to do this online but it is not working for me:
http://bytes.com/topic/net/insights/594455-row-numbers-alternate-colors-continuous-form[URL="http://bytes.com/topic/net/insights/594455-row-numbers-alternate-colors-continuous-form"]http://bytes.com/topic/net/insights/594455-row-numbers-alternate-colors-continuous-form[/URL]
I added a textbox to my frmDepartments and in the properties of that textbox:
Name = RowNum
ControlSource = =RowNum([Forms]![frmDepartments])
I then added the code in the linked example to a module.
But when the form loads, the textboxes for all the continuous records show only #Error
I have a feeling this is because my continuous form is a sub-form but I'm not sure. I can't get this working.
Update: I know it's because it's a sub-form because I just tested it for a regular continuous form that isn't a sub-form and it worked. So I guess my question is, how do I reference the form correctly now? I've tried =RowNum([Forms]![frmDepartments]), =RowNum([Forms]![frmCompanies]![frmDepartments]), and =RowNum([Forms]![frmCompanies].[frmDepartments]
I need a row number (sequential: 1, 2, 3, etc.) for each record displayed int he continuous form.
I have found an example of how to do this online but it is not working for me:
http://bytes.com/topic/net/insights/594455-row-numbers-alternate-colors-continuous-form[URL="http://bytes.com/topic/net/insights/594455-row-numbers-alternate-colors-continuous-form"]http://bytes.com/topic/net/insights/594455-row-numbers-alternate-colors-continuous-form[/URL]
I added a textbox to my frmDepartments and in the properties of that textbox:
Name = RowNum
ControlSource = =RowNum([Forms]![frmDepartments])
I then added the code in the linked example to a module.
But when the form loads, the textboxes for all the continuous records show only #Error
I have a feeling this is because my continuous form is a sub-form but I'm not sure. I can't get this working.
Update: I know it's because it's a sub-form because I just tested it for a regular continuous form that isn't a sub-form and it worked. So I guess my question is, how do I reference the form correctly now? I've tried =RowNum([Forms]![frmDepartments]), =RowNum([Forms]![frmCompanies]![frmDepartments]), and =RowNum([Forms]![frmCompanies].[frmDepartments]
Last edited: