Non Parameter Sp Result show onto form text Control Probs !

naina

Registered User.
Local time
Today, 04:39
Joined
Feb 28, 2010
Messages
19
Hi
I'm trying to write VBA code for returning Sp(non parameter) result on form's textControl field but it shows the code rather than result. my sp is tested via Query analyzer

Would you someone advise me what's wrong with this code

(Application Based On A2003 adp With Sql2000 Server)

**************************

Option Compare Database
Option Explicit
Private Function ValidData() As Boolean
If IsNull(Me.CboItem) Or Me.CboItem = "" Then
MsgBox " Select From Required Field", vbExclamation, " iNFORMATION"
Me.CboItem.SetFocus
ValidData = False
ElseIf IsNull(Me.TxtAmount) Or Me.TxtAmount = "" Then
MsgBox " Enter Code Amount", vbExclamation, " iNFORMATION"
Me.TxtAmount.SetFocus
ValidData = False
ElseIf (Me.TxtAmount) < 0.99 Then
MsgBox " Enter Code Amount", vbExclamation, " iNFORMATION"
Me.TxtAmount.SetFocus
ValidData = False
Else
ValidData = True
End If
End Function

Private Function BillChildSave() As Boolean
CurrentProject.Connection.Execute "EXEC dbo.DonorBillChild_Save'" & Me.CboItem & "','" & Me.TxtAmount & "',0"
BillChildSave = True
End Function

Private Sub txtAmount_AfterUpdate()
On Error GoTo err:
If ValidData = False Then
MsgBox " Check the all Required field", vbExclamation, " Information"
Exit Sub
Else
If MsgBox("Add another Transaction ?", vbYesNo, "Confirmation") = vbNo Then Exit Sub
If BillChildSave = True Then
'msgbox("Data Saved")
Me.TxtAmount = ""
Me.CboItem = ""
Me.CboItem.SetFocus
Me.TxtGross.Value = "EXEC dbo.getDonorBillGrs, CurrentProject.Connection.Execute"
Me.TxtDeduct.Value = "EXEC dbo.getDonorBillDeduct, CurrentProject.Connection.Execute"
Me.TxtNet.Value = "EXEC dbo.getDonorBillNet, CurrentProject.Connection.Execute"

Else
MsgBox "Error in Stored Procedure . . .", vbExclamation, " Server Error"
End If
Exit Sub
End If
err:
MsgBox err.Description, vbCritical, "Server Error"
Exit Sub
End Sub


<<<<<<<<Naina>>>>>>>







 
You need to return the result to a recordset and use this to fill your textbox.

'create connection
'create command

dim rs as new Recordset
Set rs = comm.execute

This will populate the rs object with the data from the sp, then use the recordset fields to fill the textbox.
 

Users who are viewing this thread

Back
Top Bottom