dbTalk Databases Forums  

set LinkMasterFields programmatically

comp.databases.ms-access comp.databases.ms-access


Discuss set LinkMasterFields programmatically in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jan@dontspamme.com
 
Posts: n/a

Default set LinkMasterFields programmatically - 10-04-2010 , 05:09 PM






Hi:

I have a database created in A2003 that I'm converting to A2007. It's
throwing an error that's driving me crazy because the code has worked
perfectly for years in A2003.

I have a main form with an unbound subform, and I change the subform's
recordsource based on what the user is doing. So there's some
standard code that handles that switch. The subform is called
"changeSub"

....snip
Me!changeSub.SourceObject = "xxx subform"
Me!changeSub.LinkMasterFields = "callID"
Me!changeSub.LinkChildFields = "callID"

It's failing on the 2nd line, with the error "the setting you entered
isn't valid for this property."

What am I doing wrong?

Thanks much.

Jan

Reply With Quote
  #2  
Old   
Stuart McCall
 
Posts: n/a

Default Re: set LinkMasterFields programmatically - 10-04-2010 , 05:59 PM






"jan (AT) dontspamme (DOT) com" <jan (AT) stempelconsulting (DOT) com> wrote

Quote:
Hi:

I have a database created in A2003 that I'm converting to A2007. It's
throwing an error that's driving me crazy because the code has worked
perfectly for years in A2003.

I have a main form with an unbound subform, and I change the subform's
recordsource based on what the user is doing. So there's some
standard code that handles that switch. The subform is called
"changeSub"

...snip
Me!changeSub.SourceObject = "xxx subform"
Me!changeSub.LinkMasterFields = "callID"
Me!changeSub.LinkChildFields = "callID"

It's failing on the 2nd line, with the error "the setting you entered
isn't valid for this property."

What am I doing wrong?

Thanks much.

Jan
Your code as written is referring to the subform control on your main form,
not the subform itself. You need to add .Form to refer to the subform, like
this:

Me!changeSub.Form.LinkMasterFields = "callID"
Me!changeSub.Form.LinkChildFields = "callID"

or:

With Me!changeSub.Form
.LinkMasterFields = "callID"
.LinkChildFields = "callID"
End With

Reply With Quote
  #3  
Old   
Stuart McCall
 
Posts: n/a

Default Re: set LinkMasterFields programmatically - 10-04-2010 , 06:01 PM



Please ignore my last message. Brain fade.

Reply With Quote
  #4  
Old   
Salad
 
Posts: n/a

Default Re: set LinkMasterFields programmatically - 10-04-2010 , 07:22 PM



jan (AT) dontspamme (DOT) com wrote:

Quote:
Hi:

I have a database created in A2003 that I'm converting to A2007. It's
throwing an error that's driving me crazy because the code has worked
perfectly for years in A2003.

I have a main form with an unbound subform, and I change the subform's
recordsource based on what the user is doing. So there's some
standard code that handles that switch. The subform is called
"changeSub"

...snip
Me!changeSub.SourceObject = "xxx subform"
Me!changeSub.LinkMasterFields = "callID"
Me!changeSub.LinkChildFields = "callID"

It's failing on the 2nd line, with the error "the setting you entered
isn't valid for this property."

What am I doing wrong?

Thanks much.

Jan
Is it possible the subform name (property sheet) is different than the
form name in the database window?

Reply With Quote
  #5  
Old   
jan@dontspamme.com
 
Posts: n/a

Default Re: set LinkMasterFields programmatically - 10-04-2010 , 09:32 PM



On Oct 4, 7:22*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
Quote:
j... (AT) dontspamme (DOT) com wrote:
Hi:

I have a database created in A2003 that I'm converting to A2007. *It's
throwing an error that's driving me crazy because the code has worked
perfectly for years in A2003.

I have a main form with an unbound subform, and I change the subform's
recordsource based on what the user is doing. *So there's some
standard code that handles that switch. *The subform is called
"changeSub"

...snip
* * Me!changeSub.SourceObject = "xxx subform"
* * Me!changeSub.LinkMasterFields = "callID"
* * Me!changeSub.LinkChildFields = "callID"

It's failing on the 2nd line, with the error "the setting you entered
isn't valid for this property."

What am I doing wrong?

Thanks much.

Jan

Is it possible the subform name (property sheet) is different than the
form name in the database window?
I don't think so.

The thing is, nothing has changed. It worked in A2003, it worked when
A2007 ran the A2003 database. But when I actually converted it to
A2007, it failed. So I'm thinking it's something that isn't allowed
in A2007 that was ok in prior versions.

Reply With Quote
  #6  
Old   
Rick Brandt
 
Posts: n/a

Default Re: set LinkMasterFields programmatically - 10-05-2010 , 06:27 AM



jan (AT) dontspamme (DOT) com wrote:
Quote:
The thing is, nothing has changed. It worked in A2003, it worked when
A2007 ran the A2003 database. But when I actually converted it to
A2007, it failed. So I'm thinking it's something that isn't allowed
in A2007 that was ok in prior versions.
Try setting both properties to "" prior to changing them to what you want.

Reply With Quote
  #7  
Old   
jan@dontspamme.com
 
Posts: n/a

Default Re: set LinkMasterFields programmatically - 10-05-2010 , 09:56 AM



On Oct 5, 6:27*am, Rick Brandt <rickbran... (AT) hotmail (DOT) com> wrote:
Quote:
j... (AT) dontspamme (DOT) com wrote:
The thing is, nothing has changed. *It worked in A2003, it worked when
A2007 ran the A2003 database. *But when I actually converted it to
A2007, it failed. *So I'm thinking it's something that isn't allowed
in A2007 that was ok in prior versions.

Try setting both properties to "" prior to changing them to what you want..
Brilliant! Thank you!

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.