Requiring data at form level

  • Thread starter Thread starter Control Freak
  • Start date Start date
C

Control Freak

I am having trouble with requiring data at the form
interface.

I do not want to require data at the table level, because
sometimes the data is not needed.

There is a button that when clicked, enables the fields
when the data is needed.

When the data is needed, the data cannot be Null. There
needs to be a valid string of characters, other than a
space, a period, or just entering through.

Basically, people need to answer the questions before they
are able to save their form and exit to another form in
this database.

How do I do this from within the control properties?
 
Basically, people need to answer the questions before they
are able to save their form and exit to another form in
this database.

How do I do this from within the control properties?

Put some VBA code in the Form's BeforeUpdate event:

Private Sub Form_BeforeUpdate(Cancel as Integer)
Dim iAns As Integer
If Me!txtThisMustBe & "" = "" Then
iAns = MsgBox("Please fill in all your answers, or click Cancel", _
vbOKCancel
Cancel = True
If iAns = vbCancel Then
Me.Undo ' erase the entire form
Else
Me!txtThisMustBe.SetFocus
End If
End If
End Sub
 
What if it isn't a subform, per se?

It's a section of one continuous form in which the
controls are disabled until the button is clicked. It's
not a seperate subform, or a seperate form.
 
Back
Top