Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Nov 2003
    Location
    Dunfermline, Fife, Scotland
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unable to assign a value to a form object (Access 97 SR2)

    Looking for help again.
    I am building a scientific references database. I want to assign a publisher to a reference. There are two tablesinvolved, one for References and one for Publishers. The References from carries a subfrom Linked on the tblReferences!PublicationRef and tblPublications!PublicationRef.

    To assign or change the publiser on a given reference has I have a button which calls up a lookup form. On the lookup form I have a button and some code to update the References form. To do this I am using the VB command

    Forms(pubForm1)(pubFieldValue1) = Me![PublicationRef]
    Where
    pubForm1 = Public variable for name of the references form, Variant
    pubFieldValue = Name of the control to update on the references form, Variant
    Me![PublicationRef] = the name of the control on the lookup form containing the Publication Reference I want to enter on the reference form.

    When I try and run this I get the error 2448: You can't assign a value to this object. I have checked each of the suggested causes given with the error description, the form is not read only, not in design format and the value of both fields is either autonumber or Ling Integer. I have had problems in the past with some form controls where the data field and the control name are the same but this does not make any difference. I have also tried updating the filed using the OnCurrent event on the References form and found the same error. The Publications field on tblReferences is linked (one-to-many) to the Publications Table. The link is defined as to include all records from tblReferences and only those from tblPublications where the field vaules are equal. The casade update/delete is unchecked. I have even tried deleting the relationship but still get the error. I have run out of ideas to try!

    Any suggestions as to what might be causing this error? <img src=/S/bummer.gif border=0 alt=bummer width=15 height=15>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Unable to assign a value to a form object (Access 97 SR2)

    Can you change the publisher for a reference manually in the References form?

  3. #3
    New Lounger
    Join Date
    Nov 2003
    Location
    Dunfermline, Fife, Scotland
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Unable to assign a value to a form object (Access 97 SR2)

    Hi Hans. Thans for reply.
    Yes I can update the publisher field on the references form and the sub-form updates after a record refresh. Does that suggest something to you? <img src=/S/crossfingers.gif border=0 alt=crossfingers width=17 height=16>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Unable to assign a value to a form object (Access 97 SR2)

    No, it rules out the most probable cause. <img src=/S/sad.gif border=0 alt=sad width=15 height=15>

    It's hard for me to say what could cause this without seeing the database. Perhaps somebody else has an idea. But wouldn't it be easier to use a combo box to select a publisher, instead of a form?

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Unable to assign a value to a form object (Access 97 SR2)

    If you copied and pasted the code, then the problem may be punctuation. This is what you showed:

    Forms(pubForm1)(pubFieldValue1) = Me![PublicationRef]

    Try this instead:

    Forms(pubForm1).(pubFieldValue1) = Me![PublicationRef]
    Charlotte

  6. #6
    New Lounger
    Join Date
    Nov 2003
    Location
    Dunfermline, Fife, Scotland
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Unable to assign a value to a form object (Access 97 SR2)

    Charlotte
    Thank you for that. That rings a bell and I think I have come across that problem before. Hans' respoinse prompted me to try a few more experiments and the solution appears to be for more mudane.

    In my code I use public variables to pass parameters between forms. In this case I managed to use the value of the Publications field rather than the name of the field. This presumably means that I was trying to update field one in the underlying table which is the autonumber field so it was not surprising that I could not update it.

    Managed to find the problem by placing a new field on the References form and trying to update that, this pointed to the problem.

    Thank you both for you help though in this case it was my own ineptitude that caused the problem <img src=/S/bow.gif border=0 alt=bow width=15 height=15>

Posting Permissions

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