sub form woes!

hog

Registered User.
Local time
Today, 05:16
Joined
Jan 24, 2005
Messages
14
I have a subform on my main form which I can access properties etc without error, but when I try to set the sourceobject property I get an error saying it can find the object '~sq_cfrmAction~sq_csubPlanetItems'

My form is called frmAction

The subform is called subPlanetItems

The code that errors is this;

Me.subPlanetItems.SourceObject = "qryInPlanetNotInWIMS"

The query runs fine so it is not that?

Help please
 
Me.subPlanetItems.SourceObject = "qryInPlanetNotInWIMS"

would be used to change the form object, not the query behind the form. You need to change the Record Source of the sub form.

Try this code:

Dim frm as Form
Set frm = Me!subPlanetItems.Form
With frm
frm.RecordSource = "qryInPlanetNotInWIMS"
End With
Set frm = Nothing

There's np need to requery the subform - it's automatically done when the record source is changed.

hth,
 
Hi,

yes this came to me last night. I dont know why I thought to use the query....must have drunk too much!
 

Users who are viewing this thread

Back
Top Bottom