hello,
i'm using 'Access database' and VB 6.0. My database is named ' timesheet' and it contains a table named 'tabletimesheet '. The table contain the following fields: 'staffname, stafftype, date, projectname, projectcode and hoursworked' . On my VB 6.0 form, i have got a ' list Box' containing the 'type of staff', for example 'engineer, manager or secretary'. I have got another 'list Box' containing the 'name of projects' . Also i have got 2 textboxes into which the user will enter the 'Start date' and in the other textbox, the user will enter the 'End date'. The system i'm developing should then find the total number of hours worked from the 'start date' to the 'end date' for the item selected in the 'type of staff' List Box and for the item selected in the 'name of project' List Box. For example, if i choose 'engineer' in the first List Box, i choose 'project aaa' in my second List Box, i enter '4/5/06' as 'Start date' and '10/9/06' as 'End Date', then when the user click on the button ''Calculate Hours Worked '' the 'sum of the hours worked' by the 'engineer' on 'project aaa' from '4/5/06' to '10/9/06' should be calculated and be displayed in a textbox.
I have been using 'ADODC' to connect my 'List Boxes' and the 'Start' and 'End Date' Text Boxes to the database through the 'DataSource' and 'DataField'. In the 'Provider' tab of the 'Data Link Properties' of the 'ADODC', i have selected ''Microsoft Jet 3.51 OLE DB Provider.Is it good?
Also i have inserted the following codes :
Command1_Click( )
Dim con As New ADODB.Connectio n
Dim con_string As String
Dim sql As String
Dim rs As New ADODB.Recordset
con_string = ''Provider = Microsoft.Jet.O LEDB.3.51; Data Source = '' & App.Path & '' \ '' & ''timesheet.mdb ; ''
con.Open con_string
While Not rs.EOF
If rs(1) = List1.List(List 1.ListIndex) And rs(3) = List2.List(List 2.ListIndex) And CDate(rs(2)) >= CDate(Text1.Tex t) And CDate(rs(2)) <= CDate(Text2.Tex t)
Then
hoursworked = hoursworked + rs(5)
End If
rs.Movenext
Wend
Text3.Text = hoursworked
But when i run the program, then the error message that i got is the following:
Run-time error '3706'
Provider cannot be found. It may not be properly installed.
When i click on debug button, then it indicates the following as bug:
con.Open con_string
What is the solution to my problem?
Also, when i run the program, without me entering the dates, the first date in my database is displayed in my 'Start and End Date' , which should not have been the case. How do i prevent this?
What is the solution to my problem?
Thanks
i'm using 'Access database' and VB 6.0. My database is named ' timesheet' and it contains a table named 'tabletimesheet '. The table contain the following fields: 'staffname, stafftype, date, projectname, projectcode and hoursworked' . On my VB 6.0 form, i have got a ' list Box' containing the 'type of staff', for example 'engineer, manager or secretary'. I have got another 'list Box' containing the 'name of projects' . Also i have got 2 textboxes into which the user will enter the 'Start date' and in the other textbox, the user will enter the 'End date'. The system i'm developing should then find the total number of hours worked from the 'start date' to the 'end date' for the item selected in the 'type of staff' List Box and for the item selected in the 'name of project' List Box. For example, if i choose 'engineer' in the first List Box, i choose 'project aaa' in my second List Box, i enter '4/5/06' as 'Start date' and '10/9/06' as 'End Date', then when the user click on the button ''Calculate Hours Worked '' the 'sum of the hours worked' by the 'engineer' on 'project aaa' from '4/5/06' to '10/9/06' should be calculated and be displayed in a textbox.
I have been using 'ADODC' to connect my 'List Boxes' and the 'Start' and 'End Date' Text Boxes to the database through the 'DataSource' and 'DataField'. In the 'Provider' tab of the 'Data Link Properties' of the 'ADODC', i have selected ''Microsoft Jet 3.51 OLE DB Provider.Is it good?
Also i have inserted the following codes :
Command1_Click( )
Dim con As New ADODB.Connectio n
Dim con_string As String
Dim sql As String
Dim rs As New ADODB.Recordset
con_string = ''Provider = Microsoft.Jet.O LEDB.3.51; Data Source = '' & App.Path & '' \ '' & ''timesheet.mdb ; ''
con.Open con_string
While Not rs.EOF
If rs(1) = List1.List(List 1.ListIndex) And rs(3) = List2.List(List 2.ListIndex) And CDate(rs(2)) >= CDate(Text1.Tex t) And CDate(rs(2)) <= CDate(Text2.Tex t)
Then
hoursworked = hoursworked + rs(5)
End If
rs.Movenext
Wend
Text3.Text = hoursworked
But when i run the program, then the error message that i got is the following:
Run-time error '3706'
Provider cannot be found. It may not be properly installed.
When i click on debug button, then it indicates the following as bug:
con.Open con_string
What is the solution to my problem?
Also, when i run the program, without me entering the dates, the first date in my database is displayed in my 'Start and End Date' , which should not have been the case. How do i prevent this?
What is the solution to my problem?
Thanks
Comment