|
-
Mar 30th, 2000, 02:32 AM
#1
Thread Starter
Addicted Member
I am using RDO to retrieve data from an Access database. When the data comes back, I need to handle the fact that some fields are 'Null'.
I try to core the following:
If RS1.Fields("SECONDARY_DIE") Is Null Then
txtSECONDARY_DIE.SetFocus
Else
txtSECONDARY_DIE.Text = RS1.Fields("SECONDARY_DIE")
txtSECONDARY_DIE.Locked = True
End If
... and get an error at the first line: 'Object required'. The field is empty and I really don't get what I am doing wrong.
Can anyone help on that ?
Thanks,
Francis
-
Mar 30th, 2000, 02:49 AM
#2
Fanatic Member
If you want to check for a null, try the isNull function.
Code:
If isNull(variable) Then
MsgBox "Variable is null."
End If
Hope this helps.
-
Mar 31st, 2000, 05:40 AM
#3
Addicted Member
Stevie is correct. You need to use the isNull function. I think your error is generated by the isNull being in the wrong location. Your code is very close. Change it to look like this...
Code:
If isNull(RS1.Fields("SECONDARY_DIE")) Then
txtSECONDARY_DIE.SetFocus
Else
txtSECONDARY_DIE.Text = RS1.Fields("SECONDARY_DIE")
txtSECONDARY_DIE.Locked = True
End If
-
Apr 1st, 2000, 09:39 AM
#4
Or if you want to add recordset value to a Textbox, you can use this trick:
Code:
Text1.Text = "" & rs("FieldName").Value
This way you won't get an error saying that you cannot assign NULL to the Textbox.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|