btriggs127
Technical User
I need some assistance in debugging this app I created in a student verision of VB6. The app has a command button that needs to search an Access database for records by 1 of 3 text fields that the user puts the search critia in. At this point the only thing I get when I click on the find command button is an Error 3426. the code is as follows:
Private Sub cmdFind_Click()
Dim strSearch As String, fieval As String, foundflag As Boolean
If Not Text1(1).Text = "" Then
strSearch = UCase(Text1(1).Text)
fieval = ("ID Number"
Else
If Not Text1(2).Text = "" Then
strSearch = UCase(Text1(2).Text)
fieval = ("Last Name"
Else
strSearch = UCase(Text1(3).Text)
fieval = ("First Name, Middle Initial"
End If
End If
If Len(strSearch) > 0 Then
datData1.Recordset.MoveFirst
foundflag = False
Do While (Not foundflag) And (Not datData1.Recordset.EOF)
If UCase(datData1.Recordset.Fields(fieval).Value) = strSearch Then
foundflag = True
Text1(1).Text = datData1.Recordset.Fields("ID Number"
.Value
Text1(2).Text = datData1.Recordset.Fields("Last Name"
.Value
Text1(3).Text = datData1.Recordset.Fields("First Name, Middle Initial"
.Value
Else
datData1.Recordset.MoveNext
End If
Loop
If Not foundflag Then
MsgBox "Not found", , "Not Found"
datData1.Recordset.MoveLast
End If
End If
end sub
Any assistance is greatly appericiated.
Thanks
Brian
Private Sub cmdFind_Click()
Dim strSearch As String, fieval As String, foundflag As Boolean
If Not Text1(1).Text = "" Then
strSearch = UCase(Text1(1).Text)
fieval = ("ID Number"
Else
If Not Text1(2).Text = "" Then
strSearch = UCase(Text1(2).Text)
fieval = ("Last Name"
Else
strSearch = UCase(Text1(3).Text)
fieval = ("First Name, Middle Initial"
End If
End If
If Len(strSearch) > 0 Then
datData1.Recordset.MoveFirst
foundflag = False
Do While (Not foundflag) And (Not datData1.Recordset.EOF)
If UCase(datData1.Recordset.Fields(fieval).Value) = strSearch Then
foundflag = True
Text1(1).Text = datData1.Recordset.Fields("ID Number"
Text1(2).Text = datData1.Recordset.Fields("Last Name"
Text1(3).Text = datData1.Recordset.Fields("First Name, Middle Initial"
Else
datData1.Recordset.MoveNext
End If
Loop
If Not foundflag Then
MsgBox "Not found", , "Not Found"
datData1.Recordset.MoveLast
End If
End If
end sub
Any assistance is greatly appericiated.
Thanks
Brian