Can't find source object error

Insomnia

Registered User.
Local time
Today, 22:48
Joined
Oct 9, 2004
Messages
30
Hi there!

I have this strange erro occuring on a sporadic basis. When one of my forms is opened i set one of the sub form sources objects to a table thats just been created. But when running the form I often get an error saying that the source object can't be found. Now I have tried running an adodb.recordset selecting records from the table, just before I set the source object, and that works, but still I get this error, any ideas of why?
 
A form surceobjecft cannot be a table, it must be a form name.
 
Are you really sure about this? I don't where but I think I 've heard a different story, and anyway, why does it work still work at times? If you're sure about this, do you know if/how I can a create/name a form programatically?

thank you for your time, Insomnia
 
Last edited:
Absolutely.

Because a form is an object, I suppose one could use the Add Method to create one and place controls on it and set all the appropriate properties for each control. That seems like an extraordinary amount of work. :confused:

Its quite easy to hide and position controls depending on user criteria.

As for setting a form's source object:

On a form:
Me.SourceObject = "FormName"

On a subform:
Forms!FormName!SubFormName.Form.SourceObject = "DesiredSubFormName"

I use the latter extensively, with a blank subform saved with the form, then dynamically resetting the subform sourceobject based on form criteria.
 
Last edited:
Ok , let me see, I need to create a form for which I when using it set what text fields to be shown? Do you have a sample on how to do this? would be fantastic, I need to solve this within hours.....


this is what I need to do:

A very simple datasheet needs to be displayed, Don't need any events or code on the actual form, But I need the columns to vary, aswell as the column names. we are talking about 2-10 columns, for which I will have to set the control source for all my text fields programitaclly?
 
Last edited:
Forms!MainForm!Subform.Form.FieldName1.ControlSource = "RecordSourceFieldName"

RecordSourceFieldName corresponds to the appropriate field in the subform record source.

Repeat the foregoing for each field you need to display. Hide all fields that aren't being displayed.
 

Users who are viewing this thread

Back
Top Bottom