Sohailaziz
Programmer
hi all,
i got a main Form , which got a couple of dropdowns combos. then i got a command button. and a subform with a datasheet view.
when i make selection in the combos , and click the button , i want to execute a stored procedure, and show the returned data in the datasheet (subform).
my code in the button is as follows.
Private Sub CmdSearch_Click()
On Error GoTo Err_CmdSearch_Click
Dim rsData As ADODB.Recordset
Set rsData = New ADODB.Recordset
Dim srtqry As String
rsData.ActiveConnection = CurrentProject.Connection
rsData.CursorType = adOpenDynamic
Set Cmd = New ADODB.Command
Cmd.ActiveConnection = CurrentProject.Connection
Cmd.CommandText = "dbo.ICT_Reports_LoadData_Searchform"
Cmd.CommandType = adCmdStoredProc
Cmd.Parameters.Refresh
Cmd.Parameters(1).Value = Me.ApplicationCombo.Column(0)
Cmd.Parameters(2).Value = Me.CategoryCombo.Column(0)
Set rsData = Cmd.Execute()
Me.SubFormA_SearchForm.RecordSource = rsData
'Close Connection
Set rsData = Nothing
Exit_CmdSearch_Click:
Exit Sub
Err_CmdSearch_Click:
MsgBox Err.Description
Resume Exit_CmdSearch_Click
End Sub
but this give me an error "Method or data member not found" ...
Please help, its urgent
i got a main Form , which got a couple of dropdowns combos. then i got a command button. and a subform with a datasheet view.
when i make selection in the combos , and click the button , i want to execute a stored procedure, and show the returned data in the datasheet (subform).
my code in the button is as follows.
Private Sub CmdSearch_Click()
On Error GoTo Err_CmdSearch_Click
Dim rsData As ADODB.Recordset
Set rsData = New ADODB.Recordset
Dim srtqry As String
rsData.ActiveConnection = CurrentProject.Connection
rsData.CursorType = adOpenDynamic
Set Cmd = New ADODB.Command
Cmd.ActiveConnection = CurrentProject.Connection
Cmd.CommandText = "dbo.ICT_Reports_LoadData_Searchform"
Cmd.CommandType = adCmdStoredProc
Cmd.Parameters.Refresh
Cmd.Parameters(1).Value = Me.ApplicationCombo.Column(0)
Cmd.Parameters(2).Value = Me.CategoryCombo.Column(0)
Set rsData = Cmd.Execute()
Me.SubFormA_SearchForm.RecordSource = rsData
'Close Connection
Set rsData = Nothing
Exit_CmdSearch_Click:
Exit Sub
Err_CmdSearch_Click:
MsgBox Err.Description
Resume Exit_CmdSearch_Click
End Sub
but this give me an error "Method or data member not found" ...
Please help, its urgent