I am coding in VB to add 3 fields of MS Access back end.
If there is no value (or blank) in a particular field, I want 0 to be considered in addition.

Following code is not working for checking the blank field.

If IsNull(DE_hours) Then
DE_hours = 0
End If

Please help me in recognising the blank field.

Regards,
Dinil

If IsNull(DE_hours) = true Then
DE_hours = 0
End If

regards
Ryan Riel

It is not working.
Please Help

can i ask is the DE_HOURS is textbox? or what?

its the name of field of NUMBER type in MS ACESS back end.

The back end value is being passed as as Integer parameter to a function.Inside the function i need to add De_hours value into a Sum variable.

If DE_hours is blank in the backend, I want to assign its value as 0.

try to use

On error resume next
If IsNull(DE_hours) = true Then
DE_hours = 0
End If

or if your using adodb

on error resume next
rs.open "table"
If IsNull(rs!DE_hours) = true Then
rs!DE_hours = 0
End If

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.