If type code HELP!

Kate123

New member
Local time
Today, 16:16
Joined
Feb 12, 2008
Messages
9
Please Help!

I am trying to set the on click properties of the button “Save & Close” so that one of two things happens.

a) If all related records in the subform (Edit Record) have a date in the Date Completed field then a message box pops up.
b) If all related records in the subform have not been completed then the form simply closes.

I cannot seem to get anything to work!

I have attached a screen shot of the form so you can get an idea of what I mean.
 

Attachments

  • My Form.JPG
    My Form.JPG
    18.6 KB · Views: 114
The simplest method would be to run a DCount() on the RecordSource of the SubForm using IsDate([YourDateField). You are aware that each record in your SubForm saves if it Dirty as you move to another record, Yes? That is also true for the CurrentRecord whan you move the focus away from the SubForm.
 
Thank you. I am having trouble putting that into code.

The record source for the sub form is a query called "Edit Record". I wrote

Dim LTotal As Long

LTotal = DCount("Edit Record", "Date Completed", [Not IsDate([Date Completed])])

If LTotal > 0 Then Close
If LTotal = 0 Then MsgBox "Please email the completed work"


What am I doing wrong????

Thanks
 
See if this link helps you with your syntax. All of the Domain functions use the same syntax.
 

Users who are viewing this thread

Back
Top Bottom