Forms, have controls avail for specific rows of data

  • Thread starter Thread starter cheryl
  • Start date Start date
C

cheryl

Windows 2000 Access 2000

Situation:
Have a table that includes multiple rows with the same
client name. On main form display the client name and on
subform display the rows belonging to that name as
continuous forms.

Problem:
Want certain controls on the subform to be available for
the last row per name, but not the 1st, 2nd, etc rows.
 
Hi Cheryl

Use the Form_Current event procedure:

If Me.CurrentRecord = Me.Recordset.RecordCount Then
' we are on the last record
Else
' we are further up the list
End If

If by "the last row" you mean the new record row, then you should instead
use:

If Me.NewRecord Then ...

You can either set the Enabled property to true/false or set the Visible
property likewise. Note that if the affected controls are in the detail
section, they will be changed in *all* rows.
 
1) "the last row" means the last row of data, not a new row
2) yes, the controls are in the detail section

I thought of creating a new subform and just having the 3
controls affecting in there, but when I do a query to find
the last row and base my form on that row I am not able to
do any updates. For this particular form I need to be
able to show all the detail rows for a person's name and
on the last row have controls to make comments (eg a memo
field).
-----Original Message-----
Hi Cheryl

Use the Form_Current event procedure:

If Me.CurrentRecord = Me.Recordset.RecordCount Then
' we are on the last record
Else
' we are further up the list
End If

If by "the last row" you mean the new record row, then you should instead
use:

If Me.NewRecord Then ...

You can either set the Enabled property to true/false or set the Visible
property likewise. Note that if the affected controls are in the detail
section, they will be changed in *all* rows.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Windows 2000 Access 2000

Situation:
Have a table that includes multiple rows with the same
client name. On main form display the client name and on
subform display the rows belonging to that name as
continuous forms.

Problem:
Want certain controls on the subform to be available for
the last row per name, but not the 1st, 2nd, etc rows.


.
 
Hi Cheryl

Would it be possible to place these three controls in the footer of the
subform?

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Cheryl said:
1) "the last row" means the last row of data, not a new row
2) yes, the controls are in the detail section

I thought of creating a new subform and just having the 3
controls affecting in there, but when I do a query to find
the last row and base my form on that row I am not able to
do any updates. For this particular form I need to be
able to show all the detail rows for a person's name and
on the last row have controls to make comments (eg a memo
field).
-----Original Message-----
Hi Cheryl

Use the Form_Current event procedure:

If Me.CurrentRecord = Me.Recordset.RecordCount Then
' we are on the last record
Else
' we are further up the list
End If

If by "the last row" you mean the new record row, then you should instead
use:

If Me.NewRecord Then ...

You can either set the Enabled property to true/false or set the Visible
property likewise. Note that if the affected controls are in the detail
section, they will be changed in *all* rows.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Windows 2000 Access 2000

Situation:
Have a table that includes multiple rows with the same
client name. On main form display the client name and on
subform display the rows belonging to that name as
continuous forms.

Problem:
Want certain controls on the subform to be available for
the last row per name, but not the 1st, 2nd, etc rows.


.
 
Back
Top