SubForm Add only?

  • Thread starter Thread starter Ynot
  • Start date Start date
Y

Ynot

I have a form with a subform. I would like the subform to open in add only
mode is that possible. I want to allow multiple additions but no changes
once the record is added.
 
I have a form with a subform. I would like the subform to open in add only
mode is that possible. I want to allow multiple additions but no changes
once the record is added.

Set the subforms Data Entry property to Yes.

In its After Insert event put ...
Me.Requery

Now the user can add records but they will not be able to scroll back
up to previous entries.

- Jim
 
That works when I open the subform alone but when it is opened as part of
the main form; when line one is entered you are ready to enter line 2 but
you can go back to line one and change it. I have to be able to list all
items associated with the master form just not allow changes after they are
entered.
 
That works when I open the subform alone but when it is opened as part of
the main form; when line one is entered you are ready to enter line 2 but
you can go back to line one and change it. I have to be able to list all
items associated with the master form just not allow changes after they are
entered.
Ok, if you want to be able to view the previous records but not allow
editing them then put this in the subforms On Current event. Like ...

Private Sub Form_Current()
Me.AllowEdits = Me.NewRecord
Me.AllowDeletions = Me.NewRecord
End Sub

- Jim
 
The only events I get on a subform are enter and ext. I tried the code
there and it didn't stop me from editing a record already entered.
 
The only events I get on a subform are enter and ext. I tried the code
there and it didn't stop me from editing a record already entered.
No, not the subform *control*. The form itself - that is the source of
the subform. Open it separately in design mode and enter the code I
posted.

- Jim
 
The only events I get on a subform are enter and ext. I tried the code
there and it didn't stop me from editing a record already entered.
As I mentioned in my previous post, the code goes in the form that is
the source of the subform control. Also, if you haven't already done
so, while you are in there set the forms Data Entry property to No.
You should also remove the code in the After Insert event.

- Jim
 
Back
Top