what is the code of the DoubleClick if i will search, using txtbox?

Edited 6 Years Ago by junjun61991: n/a

Dim search As New Recordset
b = "SELECT * FROM student WHERE std=" & "'" & cmbsd.Text & "'" & " AND admin=" & "'" & year.Text & "'" & ""
search.CursorLocation = adUseClient
'search.Open q, cn, adLockOptimistic, adOpenStatic
search.Open b, cn, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = search
this code write in search button click event
this code will be run error will be introduce like
datatype mismatch critiria expression
plz any body help me solve this problem

Option Explicit
Dim strSQL As String
Dim admid As Integer

Private Sub buttmain_Click(Index As Integer)
Dim uid
Dim pid

uid = username.Text
pid = password.Text

If objrs.State = 1 Then objrs.Close
strSQL = "Select*"
strSQL = strSQL + "from adm"
strSQL = strSQL + "where varusername =' " & uid & " ' "
strSQL = strSQL + "and varpassword = ' " & pid & " ' "
objrs.Open strSQL, conn, adOpenStatic, adLockReadOnly

If Not objrs.EOF Then
admid = objrs("idxadm")
ProgressBar1.Visible = True
Timer1.Enabled = True
Else
MsgBox "Either wrong username or password!", vbInformation + vbOKOnly, "Login"
Exit Sub
End If
End Sub

Private Sub buttreload_Click(Index As Integer)
username.Text = ""
password.Text = ""
username.SetFocus
End Sub

Private Sub Form_Load()
ProgressBar1.Visible = False
Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
ProgressBar1.Value = ProgressBar1.Value + 20
If ProgressBar1.Value = ProgressBar1.Max Then
Timer1.Enabled = False
ProgressBar1.Max = ProgressBar1.Max + 20
ProgressBar1.Value = ProgressBar1.Value + 20
Unload Me
End Sub


THE CODE FOR MODULE:

Public conn As New ADODB.Connection
Public objrs As New ADODB.Recordset
Public objtrs As New ADODB.Recordset

Sub main()
conn.CursorLocation = adUseClient
conn.Open "Provider = microsoft.jet.oledb.4.0; Data Source = " & App.Path & "; \ccc.accdb"
loginfrm.Show
End Sub


mY PROBLEM IS I GOT ERROR 3709 IN THE LINE OF
---->> objrs.Open strSQL, conn, adOpenStatic, adLockReadOnly

WHAT IS THE PROBLEM OR HOW I CAN FIX THIS ERROR PLS. HELP ME GUYS

THANKS A LOT PLS REFLY ME

This question has already been answered. Start a new discussion instead.