Results 1 to 6 of 6

Thread: [RESOLVED]Can you help me solve my problem ? Thanks you

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    [RESOLVED]Can you help me solve my problem ? Thanks you

    VB Code:
    1. Private Sub cmdLogin_Click()
    2. Dim pStrLoginWhere As String
    3. Dim rSLogin As Recordset
    4. Dim DecryptedPass As String
    5.     Call ValidateEmptyField(frmlogin)
    6.  
    7.             pStrLoginWhere = " WHERE User_ID = '" & txtUname.Text & "'"
    8.            
    9.             Set rSLogin = SQLSELECT("*", "UserControl", pStrLoginWhere, "", "", "Maintenance")
    10.             If Not (rSLogin.BOF = True Or rSLogin.EOF = True) Then
    11.                 DecryptedPass = RndCrypt(rSLogin!Password, "Password")
    12.                     If txtPassword.Text = DecryptedPass Then
    13.                         gstrUserGroup = rSLogin!Position
    14.                         gstrUserID = rSLogin!User_ID
    15.                         Me.Hide
    16.                         MDIMaintenance.Show
    17.                     Else
    18.                         MsgBox "Invalid Password, Please Try again", vbOKOnly, "Invalid Login"
    19.                         Call HighLight(txtPassword)
    20.                     End If
    21.             Else
    22.                 MsgBox "Invalid User Name Login.try again!", vbOKOnly, "Login!!"
    23.                 Call HighLight(txtUname)
    24.             End If
    25. End Sub
    26.  
    27. Public Sub SQLExecute(pstrDBName As String)
    28.    
    29.     Set conn = New ADODB.Connection
    30.    
    31.     conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;" & _
    32.     "Persist Security Info=true;" & _
    33.     "Initial Catalog=Maintenance;User Id=;Password=;Data Source=SHLIM\SQLEXPRESS;"
    34.    
    35.     conn.Open
    36. End Sub
    37.  
    38. Public Function SQLSELECT(pstrFIELD As String, pstrTABLE As String, pstrWHERE As String, pstrGROUPBY As String, pstrOrderBy As String, pstrDBName As String) As ADODB.Recordset
    39.     Dim pstrSELECT As String
    40.    
    41.  
    42.     pstrSELECT = " SELECT " & pstrFIELD & " FROM " & pstrTABLE & pstrWHERE & _
    43.         pstrGROUPBY & pstrOrderBy
    44.    
    45.     Call SQLExecute(pstrDBName)
    46. [U][I]    SQLSELECT.Open pstrSELECT, conn, adOpenKeyset, adLockPessimistic, adCmdText [/I][/U]
    47.    
    48. End Function

    Please help me check my code contains any problem because i obtain error of -- > Object variable or with block variable not set.

    Thanks !!!
    Last edited by nUflAvOrS; Sep 18th, 2007 at 04:47 AM.
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width