LinkChildFields and LinkMasterFields mysteriously set

F

Froefel

Hi group,

I'm experiencing the weirdest behavior on one of my forms.
The main form (Form View) has a subform (Datasheet View), but the
subform is not dependent on the main form, even though the main form
and the subform both have a field LocationID.
In the main form's design I made sure that the LinkChildFields and
LinkMasterFields properties are empty.

The expected behavior is that when clicking a record in the subform,
certain details are displayed in the main form.
I achieve this simply by dynamically setting the recordsource of the
main form in the subform's Form_Current event.

On the main form's Form_Load I am dynamically setting the recordsource
of the subform based on a radio-button in the main form, using Me.
[Subform].Form.Recordsource = strSQL

However, mysteriously, this statement automatically causes the
LinkChildFields and LinkMasterFields properties on the main form to be
set to LocationID. The result is that instead of displaying the entire
results of the SQL statament, only one record is displayed
(corresponding to the LocationID).

So my question is: why do the LinkChildFields and LinkMasterFields
properties get filled in automatically and is there a way to prevent
this from happening?

-- Hans
 
T

tina

well, it's a default action when the subform control's SourceObject property
is changed, though i've never specifically heard of it happening when you
change the subform object's RecordSource property. but the first thing that
springs to mind is: is the Name Autocorrect option turned OFF in your
database? if you didn't turn it off yourself, then it is ON; suggest you
turn it off immediately (from the database window, Tools | Options | General
tab). Name Autocorrect problems have a way of hanging around, so if you
still experience the same issue afterward, then suggest you
1. open a new blank database
2. immediately turn OFF Name Autocorrect
3. compact the database
4. import all the objects from your "working" database
5. compact again.

if that doesn't stop the behavior, then suggest you add code to the "setting
the recordsource" code, immediately after, to set the LinkMasterFields and
LinkChildFields properties to either Null or a zero-length string.

hth
 
F

Froefel

Thanks for the suggestions, tina.

AutoCorrect gets turned off in the application's startup module,
because I discovered a long time ago that it doesn't do much good and
by disabling it, my application's response time for certain operations
became many times faster.

I had implemented your second suggestion of explicitly setting the
properties to a blank string in code... and indeed that's a working
work-around.
I still would like to find the cause of this strange behavior, so I
guess I'll dig around some more.

Thanks again for your input.

-- Hans



well, it's a default action when the subform control's SourceObject property
is changed, though i've never specifically heard of it happening when you
change the subform object's RecordSource property. but the first thing that
springs to mind is: is the Name Autocorrect option turned OFF in your
database? if you didn't turn it off yourself, then it is ON; suggest you
turn it off immediately (from the database window, Tools | Options | General
tab). Name Autocorrect problems have a way of hanging around, so if you
still experience the same issue afterward, then suggest you
1. open a new blank database
2. immediately turn OFF Name Autocorrect
3. compact the database
4. import all the objects from your "working" database
5. compact again.

if that doesn't stop the behavior, then suggest you add code to the "setting
the recordsource" code, immediately after, to set the LinkMasterFields and
LinkChildFields properties to either Null or a zero-length string.

hth


Hi group,
I'm experiencing the weirdest behavior on one of my forms.
The main form (Form View) has a subform (Datasheet View), but the
subform is not dependent on the main form, even though the main form
and the subform both have a field LocationID.
In the main form's design I made sure that the LinkChildFields and
LinkMasterFields properties are empty.
The expected behavior is that when clicking a record in the subform,
certain details are displayed in the main form.
I achieve this simply by dynamically setting the recordsource of the
main form in the subform's Form_Current event.
On the main form's Form_Load I am dynamically setting the recordsource
of the subform based on a radio-button in the main form, using Me.
[Subform].Form.Recordsource = strSQL
However, mysteriously, this statement automatically causes the
LinkChildFields and LinkMasterFields properties on the main form to be
set to LocationID. The result is that instead of displaying the entire
results of the SQL statament, only one record is displayed
(corresponding to the LocationID).
So my question is: why do the LinkChildFields and LinkMasterFields
properties get filled in automatically and is there a way to prevent
this from happening?
 
T

tina

you're welcome :)


Froefel said:
Thanks for the suggestions, tina.

AutoCorrect gets turned off in the application's startup module,
because I discovered a long time ago that it doesn't do much good and
by disabling it, my application's response time for certain operations
became many times faster.

I had implemented your second suggestion of explicitly setting the
properties to a blank string in code... and indeed that's a working
work-around.
I still would like to find the cause of this strange behavior, so I
guess I'll dig around some more.

Thanks again for your input.

-- Hans



well, it's a default action when the subform control's SourceObject property
is changed, though i've never specifically heard of it happening when you
change the subform object's RecordSource property. but the first thing that
springs to mind is: is the Name Autocorrect option turned OFF in your
database? if you didn't turn it off yourself, then it is ON; suggest you
turn it off immediately (from the database window, Tools | Options | General
tab). Name Autocorrect problems have a way of hanging around, so if you
still experience the same issue afterward, then suggest you
1. open a new blank database
2. immediately turn OFF Name Autocorrect
3. compact the database
4. import all the objects from your "working" database
5. compact again.

if that doesn't stop the behavior, then suggest you add code to the "setting
the recordsource" code, immediately after, to set the LinkMasterFields and
LinkChildFields properties to either Null or a zero-length string.

hth


Hi group,
I'm experiencing the weirdest behavior on one of my forms.
The main form (Form View) has a subform (Datasheet View), but the
subform is not dependent on the main form, even though the main form
and the subform both have a field LocationID.
In the main form's design I made sure that the LinkChildFields and
LinkMasterFields properties are empty.
The expected behavior is that when clicking a record in the subform,
certain details are displayed in the main form.
I achieve this simply by dynamically setting the recordsource of the
main form in the subform's Form_Current event.
On the main form's Form_Load I am dynamically setting the recordsource
of the subform based on a radio-button in the main form, using Me.
[Subform].Form.Recordsource = strSQL
However, mysteriously, this statement automatically causes the
LinkChildFields and LinkMasterFields properties on the main form to be
set to LocationID. The result is that instead of displaying the entire
results of the SQL statament, only one record is displayed
(corresponding to the LocationID).
So my question is: why do the LinkChildFields and LinkMasterFields
properties get filled in automatically and is there a way to prevent
this from happening?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top