message empty field

pascal

isolation
Local time
Today, 06:07
Joined
Feb 21, 2002
Messages
62
I have a form with a subform. The form is based on a table with 2 fields: "ID" and "Date". The property "Required" of the field "Date" is YES. So normally when I leave this field empty in my form I should get a message but I didn't have one. Now I've tried something. I've put a third field in this table and in the form and when I now leave the field "Date" empty I get the message input is necessary. Why not without this third field?
 
Does the 3rd field have a default value?

With Date the only field on the form, if you just open the form, then close it, you don't create a new record.

Check out the Dirty property. In the OnClose event for your form put in

MsgBox Me.Dirty

to see whether the record has been changed. For the Date-only form, if you don't enter anything, the MsgBox will display False, I think. If anything gets put into any form field tied to the underlying source table or query, it should display True.

If you get a False displayed, it's won't try to store a new record, so your Required=Yes spec never comes into play.

Jim
 
Thanks Jim for your reply. I tried it out but in both cases I get the message false (with "Date" left empty and with "Date" filled in). The problem actually is that when users fill in the subform and forget to fill in the date in the parent form they cannot find their data back when they have closed and reopended the form, because the field "Date" hasn't been updated in the underlying table so I need to let appear a message when the field "Date" is left empty.
Can you help me further with this problem, Jim.
The third field had no default value.
Thank you very much.
 
First, if the field is really named just Date, you should change its name. Date is the name of an Access function and strange errors happen when you name one of your objects with a name that Access has used for something of its own.

Second, if the field is truely defined as required, there MUST be a default set somewhere. It could be in the table or in the form or you may have code somewhere that moves Date to Date.
 

Users who are viewing this thread

Back
Top Bottom