Locking subforms

J

jbruen

I have a form with a subform. Depending on the current date, I locked the
prior months fields from the main form. Depending on a field in the subform,
I want to lock all fields for that row. Is there any way to do this?
 
M

Malcolm Cook

jbruen said:
I have a form with a subform. Depending on the current date, I locked the
prior months fields from the main form.

Depending on a field in the subform,
I want to lock all fields for that row. Is there any way to do this?

use the subform's on current event procedure and set the .allowedits to true
or false depending on your date range test
 
J

jbruen

Malcom

In the parent form, I lock the prior months depending on the current date. I
noticed that I had to either unlock or lock the fields depending on the date
range since I can change years on the form.

What I have in the child/subform is a status field. I want to check if the
status field for "Closed" and lock the data for that project else I want the
current and future month's fields to be unlocked.

If I set the allowedits to true or false, will that unlock the fields I just
locked in the parent form? What will happen If I have a closed project, will
it automatically go to the next one or 1st one if that is the last project?

John
 
J

jbruen

Malcom

I put the following logic in the oncurrent event and it turned al
projectname's red and locked all rows in the subform. I just want to lock the
row which is closd and if possible tab to the next row.

If Me.ReportStatus = "02-Closed" Then
Me.ProjectName.ForeColor = lngRed
Me.AllowEdits = False
end if

In the following example, I only want to lock the row of data with "Project
2".

Example:
Jan Feb Mar ............................ Status
Project 1 1 1 1 01-Open
Project 2 2 2 2 02-Closed <=
lock this row only
Project 3 3 3 3 01-Open <=
this row may not be here

John
 
Top