Imports System.Data.OleDb
Public Class frmlog
    Dim con As New OleDbConnection
    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        If ask() = True Then
            MessageBox.Show("Success")
            Me.Hide()
            Form1.Show()
        Else
            MessageBox.Show("Invalid")
        End If
    End Sub
    Public Function ask()
        Dim dt As New DataTable
        Dim ds As New DataSet
        ds.Tables.Add(dt)
        con.Open()
        Dim da As New OleDbDataAdapter("select * from log", con)
        da.Fill(dt)

        For Each DataRow In dt.Rows

            If UsernameTextBox.Text = DataRow.item(0) And PasswordTextBox.Text = DataRow(1) Then
                con.Close()
                Return True
            End If
        Next


        con.Close()


        Return False
    End Function
    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
        Me.Close()
    End Sub

    Private Sub frmlog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        con.ConnectionString = "provider= microsoft.jet.oledb.4.0;data source = ..\db.mdb"

    End Sub
End Class

This code is for a Login Form that is connected to a database which is MS Access 2007 but everytime I enter the correct username and password and click ok, I got an error : The 'microsoft.jet.oledb.4.0' provider is not registered on the local machine.

Please help me, I need the program this week.

Recommended Answers

All 9 Replies

are you sure the database is MS Access 2007 format ?

Is the connection string correct?
And you really sure that name and password are really ok,and that the user exists in db?

uhhm..another prob..that code was for ms access 2003..and I really dont know how to connect ms access 2007 and yes the ms access file has the table, Username column, and Password column.

How MS Access 2007 is in .MDB format ? It should be .ACCDB.

Are you sure your connection string is correct? and check the version of the MS Access

I successfully debug and created this thing already..But my another problem is I don't know how to connect these user accounts to a database table wherein it will appear to textboxes after the employee log's in..Im actually creating a Billing System..How can I connect the accounts of the employee to their respective textboxes and information like Full Name, Project, Salary, Time-In and Time-out..

Im actually creating a Billing System wherein the employees work from Monday-Friday in the range of 8am-5pm (8 hrs a day). The Manager will determine their rate/hour and if they work on Saturdays there will be a 30% bonus.

The Manager can handle All modules, Add, Edit, Delete, View Employees, Clients and Projects.

I've already finished those windows for the manager, my last problem is the Time Sheets which contain all the info when the employee logged out everytime and the Billing Invoice for the Clients that will be printed on a monthly basis.

My worse problem is for the Employees. Every employee has a window that is connected to their user accounts that when they log in it shows their name,project,salary,time-in and time-out and when the employee logs out, all the records everytime they logged out will be recorded,I used textbox for the data to appear in the window, but I don't have any idea how to connect it. Also, the manager can view these records on time sheets and the manager can print a payslip for the employees.


PLEASE HELP ME, I NEED THIS PROGRAM WITHIN 3 DAYS! :(

i don't you have started writing a single line of code yet.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.