hernaezia
asked on
Send parameter to VB Data Report (VB 6.0)
I'm developing a simple system which uses VB for the interface + data report and MS ACCESS as the database. I have created an interface for searching purpose and manage to create a data report from VB. My problem is that...i'm suppose to send a parameter from the searching screen as to filter the result data in the data report.... i do not know how...
This will be the database query:
SELECT ItemName
FROM dbo.tblmstExpenses
WHERE (MONTH(ReceiveDate) = @date)
The Questions will be:
1. Can anybody help me to integrate the Searching Interface with the Data Report by sending a parameter from the Searching Screen.
2. Do I have to add-in any References or Components...
3. Help me with the steps and syntax please....
Thank You
This will be the database query:
SELECT ItemName
FROM dbo.tblmstExpenses
WHERE (MONTH(ReceiveDate) = @date)
The Questions will be:
1. Can anybody help me to integrate the Searching Interface with the Data Report by sending a parameter from the Searching Screen.
2. Do I have to add-in any References or Components...
3. Help me with the steps and syntax please....
Thank You
ASKER
Michael, it seems like i'm a bit confused with this portion
With DataReport1.Sections("sect ion1")
.Controls("col1").DataFiel d = "ItemName"
End With
can you please explain a bit this protion....becoz it seems that i do not understand the sections and controls part...
With DataReport1.Sections("sect
.Controls("col1").DataFiel
End With
can you please explain a bit this protion....becoz it seems that i do not understand the sections and controls part...
ASKER
Michael, do i have to declare the ("section1") and ("col1") part somewhere in the coding,
when i generate my coding, this message appears "The Object ''Section1 " was not found".
when i generate my coding, this message appears "The Object ''Section1 " was not found".
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ok, looks like x50Fade's answer covers everything.
but anyway...
Section1 is default Details section on Data Report. you can rename it as any other control. So check what name you have for Details Section ( it should be like "Details (theActualName)" ).
put RptTextBox Controls on Detail Section. There will appear your report's data. Rename those controls if you wish. That name comes instead of "col1" in my example.
but anyway...
Section1 is default Details section on Data Report. you can rename it as any other control. So check what name you have for Details Section ( it should be like "Details (theActualName)" ).
put RptTextBox Controls on Detail Section. There will appear your report's data. Rename those controls if you wish. That name comes instead of "col1" in my example.
As I said...hehe
I gave full solution and x50Fade helped as well.
I think split will be fair.
I think split will be fair.
I agree
ASKER
i'm sorry guys im out of town for 2 weeks..n i didnt get a chance to login to this site..sorry guyss n thankss alot...
'create Connection Object
Dim cn As New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OL
cn.Open
Dim rs As New ADODB.Recordset
Dim sSql as string
sSql= "SELECT ItemName " & _
"FROM dbo.tblmstExpenses " & _
"WHERE (MONTH(ReceiveDate) = " & txtMonth.text ' or whatever your criteria from
'open recordset
rs.Open sSql, cn, adOpenStatic, adLockOptimistic, adCmdText
Set DataReport1.DataSource = rs
'then bind your data reports fields with rs fields
With DataReport1.Sections("sect
.Controls("col1").DataFiel
End With
DataReport1.Show
I hope this help.
regards,
Michael