Allow additions

  • Thread starter ladybug via AccessMonster.com
  • Start date
L

ladybug via AccessMonster.com

I have a form called sfrm_status_of_lif_notes
In this form there are three text boxes in the Form Header. Number, Status,
and Status_dt
These three fields are automatically filled from the previous form.
In the Detail there is a text box called Notes.
When this form is opened (after entering the Status and Status_dt in the
previous form) I want the user to be able to enter in a note. After that if
anyone opens the form they can only view the notes they cannot edit them.

I set the Allow Edits to No and Allow Additions to Yes. It would not let me
type in anything in the Notes.

I then set the Allow Edits to Yes and then I could type over everything that
was in the Notes field, which I do not want.

Any suggestions?
 
D

Douglas J. Steele

Sorry, misread your question.

In the form's Current event, put code along the lines of:

Private Sub Form_Current()

If Me.NewRecord Then
Me.AllowEdits = True
Else
Me.AllowEdits = False
End If

End Sub

or the more concise

Private Sub Form_Current()

Me.AllowEdits = Me.NewRecord

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


ladybug via AccessMonster.com said:
It is updatable, because if I set it to allow edits it will let me type in
the text box.
Are you sure that the record source of the form is updatable? Check what
Allen Browne has at http://www.allenbrowne.com/ser-61.html
I have a form called sfrm_status_of_lif_notes
In this form there are three text boxes in the Form Header. Number,
[quoted text clipped - 16 lines]
Any suggestions?
 
L

ladybug via AccessMonster.com

I tried both of your suggestions and neither of them worked. I think it is
how I have my form set up and I don't know how to change it to make it work.
I guess with the code you have it is letting me edit if it is a new record.
I guess it is technically not a new record because you have to select the
status and date from the first form.
Any other thoughts? What about some event procedure in the notes on enter
event, where if it is blank you can add. If it is not blank, then you cannot
enter text. Does that make sense? Do you know what code that would be?

Thank you so much for all your help!
Sorry, misread your question.

In the form's Current event, put code along the lines of:

Private Sub Form_Current()

If Me.NewRecord Then
Me.AllowEdits = True
Else
Me.AllowEdits = False
End If

End Sub

or the more concise

Private Sub Form_Current()

Me.AllowEdits = Me.NewRecord

End Sub
It is updatable, because if I set it to allow edits it will let me type in
the text box.
[quoted text clipped - 7 lines]
 
D

Douglas J. Steele

That would be something like

Private Sub Form_Current()

Me.AllowEdits = (Len(Me!NameOfTextboxBoundToMemoField & vbNullString) = 0)

End Sub

You'd also probably want to have a button that you can use to set AllowEdits
to Yes so that corrections can be made to existing fields.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


ladybug via AccessMonster.com said:
I tried both of your suggestions and neither of them worked. I think it is
how I have my form set up and I don't know how to change it to make it
work.
I guess with the code you have it is letting me edit if it is a new
record.
I guess it is technically not a new record because you have to select the
status and date from the first form.
Any other thoughts? What about some event procedure in the notes on enter
event, where if it is blank you can add. If it is not blank, then you
cannot
enter text. Does that make sense? Do you know what code that would be?

Thank you so much for all your help!
Sorry, misread your question.

In the form's Current event, put code along the lines of:

Private Sub Form_Current()

If Me.NewRecord Then
Me.AllowEdits = True
Else
Me.AllowEdits = False
End If

End Sub

or the more concise

Private Sub Form_Current()

Me.AllowEdits = Me.NewRecord

End Sub
It is updatable, because if I set it to allow edits it will let me type
in
the text box.
[quoted text clipped - 7 lines]
Any suggestions?
 
L

ladybug via AccessMonster.com

That is perfect! Thank you for all your help!
That would be something like

Private Sub Form_Current()

Me.AllowEdits = (Len(Me!NameOfTextboxBoundToMemoField & vbNullString) = 0)

End Sub

You'd also probably want to have a button that you can use to set AllowEdits
to Yes so that corrections can be made to existing fields.
I tried both of your suggestions and neither of them worked. I think it is
how I have my form set up and I don't know how to change it to make it
[quoted text clipped - 38 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Update Event 6
Additions Denied 4
Access MS access forms list box problems 1
Combobox Value Will Not Change - Until I Right Click? 1
Edit a Form 6
Editing Data in Form 8
key tab control for subfrom 4
Editing in sub-form is locked 3

Top