Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working in VB6 and getting 3021 runtime error and i have given my code below when i running the code i'm able to view the data and with that getting 3021 error at nme=rs!NameofTest.pls help me.

What I have tried:

VB
Private Sub view_Click()

    Dim name, nme As String
    nme = rs!NameofTest
    name = CInt("&H" & nme)
    Select Case name
        Case name
                If name = 1 Then
                    If Text19.Text = glucose.Caption Then
                        display
                    End If
                ElseIf name = 2 Then
                    If Text19.Text = chol1.Caption Then
                        display
                    End If
                ElseIf name = 3 Then
                    If Text19.Text = bun1.Caption Then
                        display
                    End If
                ElseIf name = 4 Then
                    If Text19.Text = crtn1.Caption Then
                        display
                    End If
                ElseIf name = 5 Then
                    If Text19.Text = urea1.Caption Then
                        display
                    End If
                End If
         Case Else:
                MsgBox "Record not Found..!!"
                Text19.Text = ""
        End Select
        
        If rs.EOF = False Or rs.BOF = False Then
            
        Do Until rs.EOF = True Or rs.BOF = True
            rs.update
            rs.MoveNext
            view_Click
        Loop
        Else
            MsgBox "no Matching Record"
        End If
        
End Sub
Posted
Updated 1-Mar-18 21:26pm
v3
Comments
Maciej Los 2-Mar-18 3:21am    
What is exact error message? Does [rs] object has been declared and initiated? Did you try do check id [rs] object is full filled?

try
VB
nme = rs.NameofTest
 
Share this answer
 
Comments
Member 13396059 2-Mar-18 1:56am    
If i try as nme =rs.NameofTest i'm getting error as "Method or Data Member not found"
Patrice T 2-Mar-18 2:14am    
yes,but we don't know what is rs.
Member 13396059 2-Mar-18 2:43am    
Dim rs As New adodb.Recordset
Patrice T 2-Mar-18 2:47am    
And wat is supposed to be NameofTest ?
Member 13396059 2-Mar-18 6:11am    
it stores the name of the test performed
for ex: glucose,cholesterol and so on...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900