i need to view salary payslip (data report) based on that particular month and year.
in Data Environment sql :
SELECT[emp_id], [emp_name], [emp_position], [emp_bs], [month_paid], [year_paid], [total_addition], [gross_pay], [total_deduction], [total_pay] FROM salary WHERE month_paid = ? and year_paid = ?
parameter is monthler
parameter is yearler
in vb code: -
-
Dim intMonth As Integer
-
Dim intYear As Integer
-
-
' is a combo box that select month
-
-
If cboMonth.ListIndex = 0 Then
-
intMonth = 1
-
ElseIf cboMonth.ListIndex = 1 Then
-
intMonth = 2
-
ElseIf cboMonth.ListIndex = 2 Then
-
intMonth = 3
-
ElseIf cboMonth.ListIndex = 3 Then
-
intMonth = 4
-
ElseIf cboMonth.ListIndex = 4 Then
-
intMonth = 5
-
ElseIf cboMonth.ListIndex = 5 Then
-
intMonth = 6
-
ElseIf cboMonth.ListIndex = 6 Then
-
intMonth = 7
-
ElseIf cboMonth.ListIndex = 7 Then
-
intMonth = 8
-
ElseIf cboMonth.ListIndex = 8 Then
-
intMonth = 9
-
ElseIf cboMonth.ListIndex = 9 Then
-
intMonth = 10
-
ElseIf cboMonth.ListIndex = 10 Then
-
intMonth = 11
-
ElseIf cboMonth.ListIndex = 11 Then
-
intMonth = 12
-
End If
-
-
is a combo box that select year
-
-
If cboYear.ListIndex = 0 Then
-
intYear = 2007
-
ElseIf cboYear.ListIndex = 1 Then
-
intYear = 2008
-
ElseIf cboYear.ListIndex = 2 Then
-
intYear = 2009
-
ElseIf cboYear.ListIndex = 3 Then
-
intYear = 2010
-
ElseIf cboYear.ListIndex = 4 Then
-
intYear = 2011
-
End If
-
-
-
-
' how should i pass a value to a Data Environment sql query ?
-
or got other way to do ?
-
' i need view that month and year that i have selected.
-
'P_Payslip.Show
-
-
-
-
10 2981
i need to view salary payslip (data report) based on that particular month and year.
in Data Environment sql :
SELECT[emp_id], [emp_name], [emp_position], [emp_bs], [month_paid], [year_paid], [total_addition], [gross_pay], [total_deduction], [total_pay] FROM salary WHERE month_paid = ? and year_paid = ?
parameter is monthler
parameter is yearler
in vb code: -
-
Dim intMonth As Integer
-
Dim intYear As Integer
-
-
' is a combo box that select month
-
-
If cboMonth.ListIndex = 0 Then
-
intMonth = 1
-
ElseIf cboMonth.ListIndex = 1 Then
-
intMonth = 2
-
ElseIf cboMonth.ListIndex = 2 Then
-
intMonth = 3
-
ElseIf cboMonth.ListIndex = 3 Then
-
intMonth = 4
-
ElseIf cboMonth.ListIndex = 4 Then
-
intMonth = 5
-
ElseIf cboMonth.ListIndex = 5 Then
-
intMonth = 6
-
ElseIf cboMonth.ListIndex = 6 Then
-
intMonth = 7
-
ElseIf cboMonth.ListIndex = 7 Then
-
intMonth = 8
-
ElseIf cboMonth.ListIndex = 8 Then
-
intMonth = 9
-
ElseIf cboMonth.ListIndex = 9 Then
-
intMonth = 10
-
ElseIf cboMonth.ListIndex = 10 Then
-
intMonth = 11
-
ElseIf cboMonth.ListIndex = 11 Then
-
intMonth = 12
-
End If
-
-
is a combo box that select year
-
-
If cboYear.ListIndex = 0 Then
-
intYear = 2007
-
ElseIf cboYear.ListIndex = 1 Then
-
intYear = 2008
-
ElseIf cboYear.ListIndex = 2 Then
-
intYear = 2009
-
ElseIf cboYear.ListIndex = 3 Then
-
intYear = 2010
-
ElseIf cboYear.ListIndex = 4 Then
-
intYear = 2011
-
End If
-
-
-
-
' how should i pass a value to a Data Environment sql query ?
-
or got other way to do ?
-
' i need view that month and year that i have selected.
-
'P_Payslip.Show
-
-
-
-
Just posted the below, gillian3114, greetings...
Give it a whirl. I also posted another that deals with Data Environment. Will find it for you:
http://www.google.com/search?q=Data...ie7&rlz=1I7SUNA
++++++++++++++++++++++
Please search a bit deeper here if this is no help. I added "Data Report without Data Environment " to Google to fetch info included there.
Good luck with the project!
Dököll
i need to view salary payslip (data report) based on that particular month and year.
in Data Environment sql :
SELECT[emp_id], [emp_name], [emp_position], [emp_bs], [month_paid], [year_paid], [total_addition], [gross_pay], [total_deduction], [total_pay] FROM salary WHERE month_paid = ? and year_paid = ?
parameter is monthler
parameter is yearler
in vb code: -
-
Dim intMonth As Integer
-
Dim intYear As Integer
-
-
' is a combo box that select month
-
-
If cboMonth.ListIndex = 0 Then
-
intMonth = 1
-
ElseIf cboMonth.ListIndex = 1 Then
-
intMonth = 2
-
ElseIf cboMonth.ListIndex = 2 Then
-
intMonth = 3
-
ElseIf cboMonth.ListIndex = 3 Then
-
intMonth = 4
-
ElseIf cboMonth.ListIndex = 4 Then
-
intMonth = 5
-
ElseIf cboMonth.ListIndex = 5 Then
-
intMonth = 6
-
ElseIf cboMonth.ListIndex = 6 Then
-
intMonth = 7
-
ElseIf cboMonth.ListIndex = 7 Then
-
intMonth = 8
-
ElseIf cboMonth.ListIndex = 8 Then
-
intMonth = 9
-
ElseIf cboMonth.ListIndex = 9 Then
-
intMonth = 10
-
ElseIf cboMonth.ListIndex = 10 Then
-
intMonth = 11
-
ElseIf cboMonth.ListIndex = 11 Then
-
intMonth = 12
-
End If
-
-
is a combo box that select year
-
-
If cboYear.ListIndex = 0 Then
-
intYear = 2007
-
ElseIf cboYear.ListIndex = 1 Then
-
intYear = 2008
-
ElseIf cboYear.ListIndex = 2 Then
-
intYear = 2009
-
ElseIf cboYear.ListIndex = 3 Then
-
intYear = 2010
-
ElseIf cboYear.ListIndex = 4 Then
-
intYear = 2011
-
End If
-
-
-
-
' how should i pass a value to a Data Environment sql query ?
-
or got other way to do ?
-
' i need view that month and year that i have selected.
-
'P_Payslip.Show
-
-
-
-
I have used datareports BUT WITHOUT data environment, and I pass the query in form code itself
You must be having a control where you will be prompting the user to print report
Try out the below code in that control
Dim db_file As String
Dim Mycon1 As New ADODB.Connection
' Get the data.
db_file = App.Path
If Right$(db_file, 1) <> "\" Then db_file = db_file & "\"
db_file = db_file & "emp.mdb"
' Open a connection.
Mycon1.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & db_file & ";" & _
"Persist Security Info=False"
Me.Refresh
Mycon1.Open
Set m1 = Mycon1.Execute("SELECT emp_id, emp_name, emp_position, emp_bs, month_paid, year_paid, total_addition, gross_pay, total_deduction, total_pay FROM salary WHERE month_paid = " & intMonth & " and year_paid =" & intYear & "", , adCmdText)
' Connect the Recordset to the DataReport.
Set DataReport1.DataSource = m1
DataReport1.WindowState = vbMaximized
DataReport1.Show vbModal
DataReport1.Caption = "Invoice"
m1.Close
Mycon1.Close
Mycon1.Open
Set Mycon1 = Nothing
End If
This code works for me
Good Luck
I have used datareports BUT WITHOUT data environment, and I pass the query in form code itself
You must be having a control where you will be prompting the user to print report
Try out the below code in that control
Dim db_file As String
Dim Mycon1 As New ADODB.Connection
' Get the data.
db_file = App.Path
If Right$(db_file, 1) <> "\" Then db_file = db_file & "\"
db_file = db_file & "emp.mdb"
' Open a connection.
Mycon1.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & db_file & ";" & _
"Persist Security Info=False"
Me.Refresh
Mycon1.Open
Set m1 = Mycon1.Execute("SELECT emp_id, emp_name, emp_position, emp_bs, month_paid, year_paid, total_addition, gross_pay, total_deduction, total_pay FROM salary WHERE month_paid = " & intMonth & " and year_paid =" & intYear & "", , adCmdText)
' Connect the Recordset to the DataReport.
Set DataReport1.DataSource = m1
DataReport1.WindowState = vbMaximized
DataReport1.Show vbModal
DataReport1.Caption = "Invoice"
m1.Close
Mycon1.Close
Mycon1.Open
Set Mycon1 = Nothing
End If
This code works for me
Good Luck
Good job, cmrhema!
Here is the link I was looking for, gillian3114. You can query your database and furnish a report: http://www.dreamincode.net/forums/showtopic13544.htm
Give above time to load, snapshots included. Continue asking questions, we'll ge there...
Take cmrhema also, see how that works for you.
I have used datareports BUT WITHOUT data environment, and I pass the query in form code itself
You must be having a control where you will be prompting the user to print report
Try out the below code in that control
Dim db_file As String
Dim Mycon1 As New ADODB.Connection
' Get the data.
db_file = App.Path
If Right$(db_file, 1) <> "\" Then db_file = db_file & "\"
db_file = db_file & "emp.mdb"
' Open a connection.
Mycon1.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & db_file & ";" & _
"Persist Security Info=False"
Me.Refresh
Mycon1.Open
Set m1 = Mycon1.Execute("SELECT emp_id, emp_name, emp_position, emp_bs, month_paid, year_paid, total_addition, gross_pay, total_deduction, total_pay FROM salary WHERE month_paid = " & intMonth & " and year_paid =" & intYear & "", , adCmdText)
' Connect the Recordset to the DataReport.
Set DataReport1.DataSource = m1
DataReport1.WindowState = vbMaximized
DataReport1.Show vbModal
DataReport1.Caption = "Invoice"
m1.Close
Mycon1.Close
Mycon1.Open
Set Mycon1 = Nothing
End If
This code works for me
Good Luck
Nice answer so far
keep it up
Error: Object Requiered. -
-
Dim intMonth As Integer
-
Dim intYear As Integer
-
-
If cboMonth.ListIndex = 0 Then
-
intMonth = 1
-
ElseIf cboMonth.ListIndex = 1 Then
-
intMonth = 2
-
ElseIf cboMonth.ListIndex = 2 Then
-
intMonth = 3
-
ElseIf cboMonth.ListIndex = 3 Then
-
intMonth = 4
-
ElseIf cboMonth.ListIndex = 4 Then
-
intMonth = 5
-
ElseIf cboMonth.ListIndex = 5 Then
-
intMonth = 6
-
ElseIf cboMonth.ListIndex = 6 Then
-
intMonth = 7
-
ElseIf cboMonth.ListIndex = 7 Then
-
intMonth = 8
-
ElseIf cboMonth.ListIndex = 8 Then
-
intMonth = 9
-
ElseIf cboMonth.ListIndex = 9 Then
-
intMonth = 10
-
ElseIf cboMonth.ListIndex = 10 Then
-
intMonth = 11
-
ElseIf cboMonth.ListIndex = 11 Then
-
intMonth = 12
-
End If
-
-
If cboYear.ListIndex = 0 Then
-
intYear = 2007
-
ElseIf cboYear.ListIndex = 1 Then
-
intYear = 2008
-
ElseIf cboYear.ListIndex = 2 Then
-
intYear = 2009
-
ElseIf cboYear.ListIndex = 3 Then
-
intYear = 2010
-
ElseIf cboYear.ListIndex = 4 Then
-
intYear = 2011
-
End If
-
-
Dim Mycon1 As New ADODB.Connection
-
Dim m1 As New ADODB.Recordset
-
Dim strCNString As String
-
-
strCNString = "Data Source=" & App.Path & "\PayrollBakeryDB.mdb"
-
Mycon1.Provider = "Microsoft Jet 4.0 OLE DB Provider"
-
Mycon1.ConnectionString = strCNString
-
Mycon1.Open
-
-
Set m1 = Mycon1.Execute("SELECT emp_id, emp_name, emp_position, emp_bs, month_paid, year_paid, total_addition, gross_pay, total_deduction, total_pay FROM salary ", , adCmdText)
-
' Connect the Recordset to the DataReport.
-
-
Set DataReport1.DataSource = m1 ' error: object required
-
-
-
DataReport1.WindowState = vbMaximized
-
DataReport1.Show vbModal
-
DataReport1.Caption = "Invoice"
-
m1.Close
-
Mycon1.Close
-
Mycon1.Open
-
Set Mycon1 = Nothing
-
-
Error: Object Requiered.
[code]
pls sho the place where u got the error
error occur at:
Set DataReport1.DataSource = m1
error occur at:
Set DataReport1.DataSource = m1
Sorry Gillian for the trouble
Fogot to tell you that one should Declare m1 intially
Dim m1 As New ADODB.Recordset
Hello All
I have the similar problem in data environment. Though the code works well to set the data source with report.
How can I show the data in Reports. Say I have text1 as a text box in report and I want to display the data in the textbox.
Also I want to display all the records that matching the criteria :
say
select * from emp where sal >5000
Please help I am in trouble
Thanks
Hello All
I have the similar problem in data environment. Though the code works well to set the data source with report.
How can I show the data in Reports. Say I have text1 as a text box in report and I want to display the data in the textbox.
Also I want to display all the records that matching the criteria :
say
select * from emp where sal >5000
Please help I am in trouble
Thanks
Greetings and salutations, Arvindkumar!
Get a load of this link here found through Google: http://www.freevbcode.com/ShowCode.asp?ID=6307
Use this to get an idea how to modify your code to do what you need.
Please write if you are still uncertain.
In a bit, and good luck...
Dököll
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jack |
last post by:
Hi,
I am trying to test a sql statement in Access which gives me
the error as stated in the heading.
The sql statement is built as a part of asp login verification,
where the userid and password...
|
by: Bob Alston |
last post by:
Anyone out there successfully deployed Data Access Pages, on a server
they do not control, using RDS in a 3-tier environment? If so I would
like to hear about your success.
From my reading, RDS...
|
by: Jon Davis |
last post by:
I like the drag-and-drop accessibility of dragging a table to a Web Forms
designer and seeing a SqlDataAdapter automatically created for me.. being
able to create a DataSet from that is fun and...
|
by: EO |
last post by:
I am trying to use the MSFT data access application block on 3 machines.
Machine 1:
Sandbox environment; I installed the application block with the msi. The
Sqlhelper class compiles & runs...
|
by: sjl |
last post by:
I've got an .aspx webform for searching my database. It basically takes user
input and passes it as a parm into a stored proc to search a table. The
results are returned in a SQLDataReader and...
|
by: Doug Bell |
last post by:
Hi,
I have an application that has a "Data Access Class" and "User Interface
Class".
It is for receiving Purchase Order data from one system and pushing
processed transactions to another...
|
by: Arno |
last post by:
reposted with the right microsoft managed newsgroup ID: Sorry for the
inconvinience
Hi,
I've written a class for client-socket connection, but I get a lot of times
the error message "Unable...
|
by: kowndinya |
last post by:
I have created a small program with Data Environment. database is MS Access.
It is working fine on my computer where VB 6 was Installed. I want to use this program on different machines where there...
|
by: manugm1987 |
last post by:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css"><!--...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
| |