2757 error on setting recordsource for form

C

Chris

Hi,

I have a main form with a 3 page tab-strip.

This is an access data project connecting to SQL Server 2000.

Each tab page contains a subform. When a user switches between each
tabbed page a new grid is loaded based on fields from the current record in
another
tab.

I created a sub procedure that accepts the current grid as an argrument to
reduce code.
Public Sub LoadTabbedGrid(currentForm As Form, searchvalue1 As String,
storeprocedurename As String)

it is called like this:

Call LoadTabbedGrid(Me.SubFormChild1.Form, sparam, "subprocedurename")

this works great when changing between tabs

Problem: i have a checkbox on the middle tab. when a user clicks on it it
changes
it is supposed to reload the grid with a new specific sub procedure.

It works once, but once i uncheck it, it fails on trying to excecute the
other subprocedure.

this is my click event.

Private Sub chkAllDetailTransit_Click()
Call TabCntrlMain_Change

End Sub

this is my change event

Private Sub TabCntrlMain_Change()
'when a user clicks on a page tab and changes the current view.
Dim sparam As String
Dim imsg As Integer

If Me.TabCntrlMain.Value = 1 Then

If Me.chkAllDetailTransit.Value = -1 Then
'Get all Transit Details do not get transits only for current record
in Summary Tab.
Me.SubFormChild1.Form.RecordSource = "dbo.GetAllTransitDetails"

ElseIf Me.chkAllDetailTransit = 0 Then

sparam = "'" & Me.subformParent.Form.Currency.Value & "'" & "," &
"'" & Me.subformParent.Form.APP.Value & "'" & "," & "'" &
Me.subformParent.Form.type2.Value & "'" & "," & "'" &
Me.subformParent.Form.TransitType.Value & "'"
Call LoadTabbedGrid(Me.SubFormChild1.Form, sparam,
"GetAudit-Sum-app2")
Call Load_TotLabels("getTransitDetailTotal",
Me.subformParent.Form.Currency.Value, Me.subformParent.Form.APP.Value,
Me.subformParent.Form.type2.Value, Me.subformParent.Form.TransitType.Value)

End If

When I try to reload the grid from changing the check box I get error
2757: There was a problem accessing a property or method of the OLE object.

I have debugged this to death and can't understand why there is a problem.

thanks

Chris
 
Top