English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Whenever I run my Program "Invalid Use of Null" occurs.

Here is the code. I have also made a module.

Private Sub Form_Load()
Set Conn1 = New ADODB.Connection
Call OpenDB

sSQL = "SELECT DISTINCT Name FROM Authors"
Set Rs1 = New ADODB.Recordset
Rs1.Open sSQL, Conn1, adOpenDynamic, adLockOptimistic, adCmdText

List1.Clear
Rs1.MoveFirst
Do Until Rs1.EOF
List1.AddItem Rs1.Fields(0) ---> this is the problem
Rs1.MoveNext
Loop
End Sub

2007-09-30 16:47:43 · 2 answers · asked by Ryan B 1 in Computers & Internet Programming & Design

2 answers

change it to...

sSQL = "SELECT DISTINCT ISNULL(Name,'') as Name FROM Authors"

2007-09-30 16:56:32 · answer #1 · answered by David S 2 · 0 0

Run Time Error 94

2016-11-07 04:18:37 · answer #2 · answered by Anonymous · 0 0

This Site Might Help You.

RE:
How do i fix Run Time Error 94 in Visual Basic 6?
Whenever I run my Program "Invalid Use of Null" occurs.

Here is the code. I have also made a module.

Private Sub Form_Load()
Set Conn1 = New ADODB.Connection
Call OpenDB

sSQL = "SELECT DISTINCT Name FROM Authors"
Set Rs1 = New ADODB.Recordset
...

2015-08-19 14:10:06 · answer #3 · answered by Stephania 1 · 0 0

Hi,
Ur programme is correct, but problem is in table "Authors". In the first field of the table Author at least one value will be blank or null, that is giving problem. u fill those blank entries in the first field of the table Author and run ur code.

2007-09-30 17:44:28 · answer #4 · answered by iqbal 4 · 0 0

fedest.com, questions and answers