473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Problem with my codes

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
3 2069
sashi
1,754 Expert 1GB
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
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
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

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

Similar topics

3
by: N4M | last post by:
Dear, I have codes as follows: template<class T> class A { public: // embedded class class E; public: // types typedef E TE; public:// member functions TE somefunc();
10
by: dof | last post by:
I'm trying the following and having problems. I get errors on the array declaration lines. Something about an array must have at least one element. Thanks in advance. D #include stuff .... ...
2
by: Ecohouse | last post by:
I'm creating a query with a where statement using VBA to create a DAO recordset. I've separated the query to make it easier to read. This is the query: SELECT .Race, Count(.Race) AS...
0
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2...
5
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2...
16
by: Hooyoo | last post by:
Following are similar codes of my project: At first I define two classes in two files: //ClassA.h #pragma once #include "ClassB.h" class ClassA { public: ClassA(void){};
12
by: Light | last post by:
Hi all, I posted this question in the sqlserver.newusers group but I am not getting any response there so I am going to try it on the fine folks here:). I inherited some legacy ASP codes in my...
2
by: PoN | last post by:
Hello everyone.. i have to write codes in VB to solve the travelling salesman problem but i dun know how to start. So if ANYONE knows the codes, pls post it here. Or if there is a previous post on...
2
by: darrel | last post by:
Hi there vb masters i have a problem regrading the saving procedure in my program: Here my code: Private Sub cmdSave_Click() Dim rsShowRec As New ADODB.Recordset Dim cnn As New...
17
by: may bailey | last post by:
Hi all, I have been trying to use a show / hide script on my web site but when I click on the "hide" button there occurs an error with explorer 7. The web site starts to go down =) and there...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.