How to make dropdown default to 0

cdoyle

Registered User.
Local time
Today, 11:10
Joined
Jun 9, 2004
Messages
383
Hi,

I have a form, with some dropdowns that are bound to some table fields.

In the table I have the fields defaulted to 0, and on the form I have the dropdowns defaulted to 0 too.

But here is the problem I'm facing, if a user is making an entry and accidently enters something into a dropdown, and then changes their mind and erases what they put in the field.

When they save the record, it's saving this field as a null instead of 0.

Is there a way to make it so, if they erase the field that defaults to 0 too?
 
You could put a conditional statement prior to save either through the button or possibly on the BeforeUpdate event of the control.

Code:
If Len(Nz(Me!ThisControl, "")) = 0

-dK
 
You could put this in the control's after update event:

If IsNull(Me.YourControlNameHere) Then Me.YourControlNameHere = 0
 
You could put this in the control's after update event:

If IsNull(Me.YourControlNameHere) Then Me.YourControlNameHere = 0

I just tried this, and when I try and make a selection I get an error
can't find the macro 'If isNull(Me.'
 
I prefer this:

If Me.YourControlNameHere & "" = "" Then Me.YourControlNameHere = 0
 

Users who are viewing this thread

Back
Top Bottom