The environment of the program is VB6 + ADO + Access, when you query with SQL statements, you want to combine two fields into one field, but one of the null values in one field directly causes two fields to merge and become null values. Before can only use VB in the IsNull respectively processing the value of two fields, the previous time want to try to solve with SQL statement directly, did not succeed, almost give up the occasion to find the answer, summarized as follows:
Objective :
Implementing Select (Field 1 + field 2) as A
Questions :
Field 2 if NULL (NULL), the value of a is a null value regardless of whether the value of field 1 is empty (null)
Solution :
1. In Access, you can use Nz (the field, the value of NULL) to handle
2. In VB6 + database, use IFF (isNull (field), null value, not NULL value) to handle
Resolves an issue in which SQL queries handle Null values when accessing a database with ADO in VB (using IFF (isNull (field), null value, not NULL value))