By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,602 Members | 1,507 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,602 IT Pros & Developers. It's quick & easy.

Problem with my codes

P: 8
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.Connection
Dim con_string As String
Dim sql As String
Dim rs As New ADODB.Recordset
con_string = ''Provider = Microsoft.Jet.OLEDB.3.51; Data Source = '' & App.Path & '' \ '' & ''timesheet.mdb; ''
con.Open con_string
While Not rs.EOF
If rs(1) = List1.List(List1.ListIndex) And rs(3) = List2.List(List2.ListIndex) And CDate(rs(2)) >= CDate(Text1.Text) And CDate(rs(2)) <= CDate(Text2.Text)
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
Dec 14 '06 #1
Share this Question
Share on Google+
3 Replies


sashi
Expert 100+
P: 1,754
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.Connection
Dim con_string As String
Dim sql As String
Dim rs As New ADODB.Recordset
con_string = ''Provider = Microsoft.Jet.OLEDB.3.51; Data Source = '' & App.Path & '' \ '' & ''timesheet.mdb; ''
con.Open con_string
While Not rs.EOF
If rs(1) = List1.List(List1.ListIndex) And rs(3) = List2.List(List2.ListIndex) And CDate(rs(2)) >= CDate(Text1.Text) And CDate(rs(2)) <= CDate(Text2.Text)
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
Hi there,

Which version of MSAccess are you working on? If you are on Access 200 then you should change the OLE DB Provider to 4.0, hope it helps. Good luck & Take care.
Dec 15 '06 #2

P: 15
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.Connection
Dim con_string As String
Dim sql As String
Dim rs As New ADODB.Recordset
con_string = ''Provider = Microsoft.Jet.OLEDB.3.51; Data Source = '' & App.Path & '' \ '' & ''timesheet.mdb; ''
con.Open con_string
While Not rs.EOF
If rs(1) = List1.List(List1.ListIndex) And rs(3) = List2.List(List2.ListIndex) And CDate(rs(2)) >= CDate(Text1.Text) And CDate(rs(2)) <= CDate(Text2.Text)
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

Have u solve the problem, if not u send me the email to my address to rockford333@gmail.com, with subject con problem.
Dec 15 '06 #3

P: 3
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.Connection
Dim con_string As String
Dim sql As String
Dim rs As New ADODB.Recordset
con_string = ''Provider = Microsoft.Jet.OLEDB.3.51; Data Source = '' & App.Path & '' \ '' & ''timesheet.mdb; ''
con.Open con_string
While Not rs.EOF
If rs(1) = List1.List(List1.ListIndex) And rs(3) = List2.List(List2.ListIndex) And CDate(rs(2)) >= CDate(Text1.Text) And CDate(rs(2)) <= CDate(Text2.Text)
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
Hi there,
first check the version of ur Access. If u r working on 2000 use OLEDB.4.0. else

use this kind of connection
command1_click()
dim con as connection
dim rs as recordset

set con=new adodb.connection
with con
.provider="Microsoft.Jet.OLEDB.3.51"
.connectionstring="uid=;pwd=;data source=" & App.path & "\" & "timesheet.mdb;"
.open
end with

hope this will solve ur problem
Dec 15 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.