Dear friends iam making a vb program when i created splash screen and run the program splash screen run ok and next form with login pop up but when i enter my password to login on second form(FRMMAIN.frm) it give me error.when i remove splash screen it becomes ok again
here is both codes and iam highlighting the problem area
splash screen code

Option Explicit

Private Sub Form_KeyPress(KeyAscii As Integer)
    Unload Me
End Sub

Private Sub Form_Load()
    lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
    lblProductName.Caption = App.Title
End Sub

Private Sub Frame1_Click()
    Unload Me
End Sub

now the form FRMMAIN which gets error

Private Sub BCancel_Click()
FRMMAIN.MyOpen = False
Unload Me
End Sub

Private Sub BOK_Click()
Dim rs As New Recordset
With rs
    If .State <> 0 Then .Close
    .CursorLocation = adUseClient
    .Open "Select * from Users", MyData.MyUsers, adOpenDynamic, adLockOptimistic---- iget error here...
    If .RecordCount <> 0 Then
        If .Fields!Password = Tpass.Text Then
            MsgBox "Access granted.", vbInformation, "Granted"
            FRMMAIN.MyOpen = True
            MsgBox "Access Denied.", vbCritical, "Denied"
            FRMMAIN.MyOpen = False
        End If
    End If
End With
Unload Me
Set rs = Nothing
End Sub

Private Sub Tpass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then BOK_Click
End Sub

kindly help me

7 Years
Discussion Span
Last Post by AndreRet

i don't understand your logic of authentication.

How Select * from Users ensures that the user id exists and the password entered matches with that stored in DB ?


Hi Satti,
As you state that bypassing the splash screen it works ok, then I think you can resolve the problem by setting frmMain as the initial Startup Object, and load the splash screen from the Form_Load event of frmMain in 'VBModal' mode so that frmMain code is halted whilst the splash screen is open.

Hope this helps,


maybe you show any form in modal mode when u want show new form in normal mode after modal form show u err


If I read this correctly, your way of thinking is there. It is the execution thereof that you need to work on.
You have used 'keypress' as an option with your Splash Screen. Yet you have not identify the ASCii key to unload your screen and load the Main Form. Maybe you should use ta timer or alike to unload as you used in the frame_click event.

Also try and use adopenstatic and not adopendynamic. There is obviously a problem to your connection with the database here. Therefor the error on your select statement. Try the following:

Private WithEvents cnConnection As ADODB.Connection
Private WithEvents rsConnection As ADODB.Recordset
Set rsConnection = New ADODB.Recordset

rsConnection .Open "SELECT * FROM Users", cnConnection , adOpenStatic, adLockOptimistic

The other thing is that I understand that your Login form is your Main Form? how can you show the main form AFTER login? Try and create a seperate login form with connection to the user login data and then show your Main Form.

I've attached a sample project, which should help you understand more about login. Reply if something is unclear


Rather late than never.;)

:) yea its too late anyways kindly visit my thread flexgrid wih acess ..if u can help

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.