Frustrated with combobox problem

sailorguy

Registered User.
Local time
Today, 08:53
Joined
Jan 31, 2008
Messages
48
Hi,

I have a 2 column combobox which updates a table. The combobox field is not a required field in the table, but if nothing is entered, the table field needs to be zero. The table field property "default value" is set to "0".

If I select a record in the combobox, but then backspace because it should have been empty, the table field ends up with a null value which causes problems elsewhere.

How can I make sure that instead of being null, it becomes a zero? It's driving me crazy!
 
Can you not put a 0 in the combo box to use instead of backspace?
Else you will have to tackle the problem at the 1st point of use with the NZ function, which may be the safe thing to do anyway.

Brian
 
I'm not familiar with this function. How is this used on this combobox?
 
Read about NZ in help.
It is not used on the combobox but in say a query to handle Null fields.

Brian
 
O.k. sorry I'm a newbie...

So my combobox source is a query. The query itself doesn't have any NULL values, but if I choose a value then backspace it the table is updated with a NULL value for that field. I can't add a 0 in the combobox because there are no 0 values in the table that the query runs on.

So using NZ, as I've been reading will make the query return NULLs as a 0. But that's not my problem because the query isn't returning a 0. Do I make sense???

I'm not sure how to explain this.
 
The NZ is for use when you later use the data, as I said in post2
Else you will have to tackle the problem at the 1st point of use with the NZ function, which may be the safe thing to do anyway.
. This will probably be in a query, but could be in VBA code.

Brian
 
OK, I got this figured out...

If Me.cmbDN & "" = "" Then
Me.cmbDN = 0
End If

For each of the fields
 

Users who are viewing this thread

Back
Top Bottom