Code Notes field NOT to accept (save) notes that contain no data.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I have a subform on my main form which holds notes for each customer. I want
to set up the notes section so that it will not save it there is no input.

Can anyone help???
 
Hello

I have a subform on my main form which holds notes for each customer. I want
to set up the notes section so that it will not save it there is no input.

Can anyone help???

Open the form you're using as the subform in design view. View the
form's Properties; on the Events tab select the BeforeUpdate event,
and click the ... icon by it. Choose Code Builder. Edit the two lines
Access gives you by adding code between them:

Private Sub Form_BeforeUpdate(Cancel as Integer)
If Len(Me!Notes & "") = 0 Then ' did user leave notes blank?
Cancel = True ' if so, cancel the update
Me.Undo ' and erase the current subform record
End If
End Sub

John W. Vinson[MVP]
 

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

Back
Top