Here is a hint for DB
Sub Check_From_DB()
Dim Cn As ADODB.Connection '* Connection String
Dim RS As ADODB.Recordset '* Record Set
On Error GoTo ADO_ERROR
Set Cn = New ADODB.Connection
Cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\login.mdb;Persist Security Info=False"
Cn.ConnectionTimeout = 40
Cn.Open
Set RS = New ADODB.Recordset
sQuery = "Select * From PWD_TAble Where User = '" & sUser & "' and Password = '" & sPwd & "'"
RS.ActiveConnection = Cn
RS.Source = sQuery
RS.Open
If RS.EOF = True And RS.BOF = True Then
MsgBox "Invalid Username or password"
Else
Form2.Show
End If
Application.StatusBar = False
If Not RS Is Nothing Then Set RS = Nothing
If Not Cn Is Nothing Then Set Cn = Nothing
MsgBox "Completed!!!"
ADO_ERROR:
If Err <> 0 Then
MsgBox Err.Description
Err.Clear
Resume Next
End If
End If
End Sub
Cheers
Shasur
http://www.dotnetdud.blogspot.com
VBA Tips & Tricks (
http://www.vbadud.blogspot.com)