Results 1 to 3 of 3

Thread: Generic Objects

  1. #1
    Join Date
    Mar 2002

    Unanswered: Generic Objects

    Hi All:

    I have a line of vba code..

    aRelationship.fields!<WHAT TO FILL IN?>.ForeignName = "NameOfForeignKeyField"

    Access wants a name of a primary key field in <WHAT TO FILL IN?> without quotes

    In the part that says <WHAT TO FILL IN?> I tried substituting a string variable holding a field name but that errored out.

    The field name changes all the time so i can't hard code it in.

    QUESTION: Is there a way of passing a field name to that line of code that does not require a string variable?

    I think the solution lies somewhere in substituting an object of some sort there.

  2. #2
    Join Date
    Nov 2002
    Have you tried the dot-notation? As in:
    aRelationship.fields(strFieldName).ForeignName = "NameOfForeignKeyField"
    where strFieldName is the string variable holding your field name.

  3. #3
    Join Date
    Mar 2002
    OMG it worked! A Million Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts