Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with loading data into a SubForm (datasheet) from a SP 1

Status
Not open for further replies.

Sohailaziz

Programmer
May 13, 2005
9
0
0
GB
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

 
The error was on this line

Me.SubFormA_SearchForm.RecordSource = rsData

I solved it, the problem was i setting recordsource to recordset....
the solution was
me.subformA_SearchForm.recordset=rsData

thanks for your time...


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top