cancel
Showing results for 
Search instead for 
Did you mean: 

vb6 is not null

Former Member
0 Kudos
10,897

Hi, Visual Basic 6; mysql = ( select something from table )

which will return some columns with some 'NULL's . Expected, no problem.

My If mysql(index) = NULL then else end if.

FAILS all the time.

Am I having a stupid moment?

I can get this to work:

if mysql(index) = "" then else end if

this seems to work, but I can not test on the "null" word. Have I looked at it too many hours? SMILE

Accepted Solutions (1)

Accepted Solutions (1)

chris_keating
Product and Topic Expert
Product and Topic Expert

Use VB IsNull() method. i.e.,

dim rs as ADODB.recordset

set rs=new adodb.recordset
rs.open {mysql}
do while not rs.EOF
    if IsNull( rs.Field(1).value) then ...

  rs.movenext
loop
Former Member
0 Kudos

I was concerned that null in sybase was different then in MS SQL, the statements do not work the same. I will try the IsNull. Starting at 6am and going until my eyes and brain give out.... is not good any more. thanks I will do it this way. I don't know why I could not see it. SMILE Again thanks

Former Member
0 Kudos

If IsNull(myRSTM(8)) Then Else Me.txtCustomerName = myRSTM(8) End If Works; I am reading a single record and filing out text boxes only. For some reason me.txtValue fails when the field is null. Even Dim string fails. Same code for MS SQL, that is what way throwning me. I don't now this voting thing, your IsNUll fixed it.

Answers (0)