Mandatory Fields

D

D

Hi:

I have this code in a form; can you please tell me how can I make the
records that allow edits to have all the fields mandatory (cannot go to the
next one until the previous is properly entered)

Thank you,

Dan

Private Sub Form_Current()

If Me!RecType = "fy08a" Then
Me.AllowEdits = False
Me.AllowDeletions = False
'MsgBox ("FY08 Actuals; this record is read only. Please click OK and
navigate to the next record")

ElseIf Me!RecType = "fy09b" Then
Me.AllowEdits = False
Me.AllowDeletions = False
'MsgBox ("FY09B Budget; this record is read only. Please click OK and
navigate to the next record")

Else
Me.AllowEdits = True
Me.AllowDeletions = True

End If
 
S

Shiller

Hi:

I have this code in a form; can you please tell me how can I make the
records that allow edits to have all the fields mandatory (cannot go to the
next one until the previous is properly entered)

Thank you,

Dan

Private Sub Form_Current()

If Me!RecType = "fy08a" Then
Me.AllowEdits = False
Me.AllowDeletions = False
'MsgBox ("FY08 Actuals; this record is read only. Please click OK and
navigate to the next record")

ElseIf Me!RecType = "fy09b" Then
Me.AllowEdits = False
Me.AllowDeletions = False
'MsgBox ("FY09B Budget; this record is read only. Please click OK and
navigate to the next record")

Else
Me.AllowEdits = True
Me.AllowDeletions = True

End If

You can take care of that at the table level. Open the table in
Design view, select the column, then under the general tab at the
bottom left side of the screen change "Required" to Yes.

Shiller

http://sites.google.com/site/microsoftaccesstips/
 
J

John W. Vinson

I have this code in a form; can you please tell me how can I make the
records that allow edits to have all the fields mandatory (cannot go to the
next one until the previous is properly entered)

Use the Form's BeforeUpdate event. Either explicitly test each control, or
loop through the form's Controls collection; if any data-bearing control is
NULL, warn the user and set the routine's Cancel argument to True.
 
D

D

Thanks John!

Dan

John W. Vinson said:
Use the Form's BeforeUpdate event. Either explicitly test each control, or
loop through the form's Controls collection; if any data-bearing control is
NULL, warn the user and set the routine's Cancel argument to True.
 

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

Top