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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do not save record if fields are empty

Status
Not open for further replies.

mauricionava

Programmer
Jul 8, 2005
209
0
0
US
I have a form where an autonumber is creating records automatically even if I do not have any data in any other fields. I do not want my form to save records if the fields are all blank.

What command should I use and where?

Thanks.
 
Isn't there one field that should never be null?

Set the Required property to Yes for that field.

 
Can't see why it would create records automatically. The only way this will happen I think is if you hit the spacebar in any one field. Even with default values, it should not save records unless an entry has been made.

If you are trying to make sure certain fields are entered before saving, then you need to at the minimum set the "Required" property for such fields to "YES" as Liliabeth mentioned.

-- Fast Learner, I Think

Here's something to think about. How come you never see a headline like 'Psychic Wins Lottery!'? - Jay Leno
 
A common way is to enforece the validation rules in the BeforeUpdate event procedure of the form, playing with the Cancel argument to avoid storing wrong values.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
how about checking if any data is entered on the form by putting the key field on it. If the key field is an auto number then it should display "autonumber" if if not field is altered. Other wise it will display the next auto number.

Ian Mayor (UK)
Program Error
Programming is 10% coding and 90% error checking.
 
mauricionava . . .

[ol][li]Thru [blue]normal access operations[/blue] a record can be saved only if its in edit mode ([blue]Dirty[/blue] property is true).[/li]
[li]To put a record in [blue]edit mode[/blue], at least one character has to be typed in the record.[/li]
[li]AutoNumber doesn't update until you [blue]put a new record in edit mode . . .[/blue][/li][/ol]
Its also possible your're being fooled by a subform where the linking field is updated when you edit a new record in the parent form. The linking field here is set as an default and the [blue]Dirty[/blue] property is not set!

Either you have code saving a record or you have corruption!

Are you saying you can see these records in the table?

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top