Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what if scenario 2

Status
Not open for further replies.

Pammy46

Technical User
Jun 6, 2005
2
GB
I have 2 colums in an access table one containing a status of a case CLOSED or PENDING. The other column is the date CLOSED - how can I ensure that once CLOSED option is selected by the user that the Date closed must be filled?? as the users are forgetting to put closed date in and data is lost for analysis
 
You cannot control this at table level.
You must use a form for data entry.

In the Form_Beforeupdate event procedure test the field:

Private Sub Form_BeforeUpdate(Cancel As Integer)
if me.txtStatus <>"Closed" then exit sub
if isnull(me.txtDateClosed) then
msgbox "You must enter the closed date"
Cancel = true
else
snd if


End Sub
 
There are some possibilities for setting table level validation. Try an expression in the table Validation Rule of:[blue]
IIf([status]="Closed",Not IsNull([DateClosed]),-1)[/blue]


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top