|
-
Mar 8th, 2001, 12:20 PM
#1
Thread Starter
Junior Member
Hi,
I have been trying to do this for a couple days now... it seems easy, but it's not.
This is what I have and know:
My database is in SQL Server 7
My application is in VB6
I am working on creating a Report.
Did:
-Set up a DataEnvironment command which uses a stored procedure that has a Parameter.
-Set up a report design.
-Have a form where I ask the user to choose a value from a drop down list to be used as a value for a parameter of the stored procedure.
On the click event of OK button of the form I have this:
strProgramID = cmbJobsPrograms.ItemData(cmbJobsPrograms.ListIndex) -->gets value chosen by the user from cmbJobsPrograms
deCCDB.comParticipantsHistory (strProgramID) --> assign (or try to assign) value to the parameter.
deCCB = data environment
comParticipantsHistory = command that holds the stored procedure
rptParticipantHistory.Show
The problem is: I get an error saying that "No value given for one or more parameters"
I tried playing with the data types on the parameters tab of the command object in the data environment, but I started getting data types errors.
What am I doing wrong??? Is there another way???
How do I pass a value from a form to be used as a parameter in a stored procedure??
PLEASE HELP!!!!!!
Juls.
-
Mar 8th, 2001, 01:45 PM
#2
try this:
Code:
Private Sub cmdOK_Click()
If DataEnvironment1.rsCommand1.State = 1 Then
DataEnvironment1.rsCommand1.Close
End If
DataEnvironment1.rsCommand1.Open "spYourStoredProc ('yourParam')"
DataReport1.Show
Set DataEnvironment1 = Nothing
End Sub
hope this helps.
-
Mar 8th, 2001, 02:28 PM
#3
Thread Starter
Junior Member
I am getting an "Incorrect syntax" error. It is pointing to here
('yourParam')
What's the correct syntax?
What should yourParam contain? variable that holds the value of the combo box?
Can you please give me an example?
Thanks so much....
-
Mar 8th, 2001, 02:42 PM
#4
okay, try this. your parameter's gonna be the selected item on your list box, right? so,
Code:
DataEnvironment1.rsCommand1.Open "spYourStoredProc ('" & cmbJobsPrograms.ListIndex & "')"
hope this helps!
-
Mar 8th, 2001, 04:14 PM
#5
Thread Starter
Junior Member
Thanks,
That solved this problem, however I had to get rid of paranthesis () around '" & cmbJobsPrograms.ListIndex & "'
However, now I have another problem:
My Command1 has a child command under it that runs another stored procedure. When I run this report it doesn't seem to find the field that runs from this child command.
Any ideas????
Is there a set way that I can make a report without using a data environment? and still be able to set up groupings (in case of one-to-many relationships)
Thanks again!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|