Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2002
    Posts
    9

    Red face Unanswered: Assigning a value to a control with a source

    Hi. This is probably a very basic problem (I hope it is, anyway) but I'm having trouble finding anything to help me.

    I have a form (say, FormA) which has all of its controls bound to a table.
    I have the 'DataEntry' property for FormA set to 'yes' so that the controls are always bound to the newest record, correct?

    I have another form (say, Form1) on which I have placed a button that opens FormA. I want to pass a value from a control on Form1 to a control on FormA when it is opened (I know how to do this using OpenArgs - this is not my problem).

    My PROBLEM is that, when I push the button on Form1, I get the error

    Run-time error '-2147352567 (800 20009)'
    You can't assign a value to this object.

    HOWEVER, if I make the control on FormA (the one receiving the value) an unbound control, then there is no problem - of course, this is not what I want because I WANT the data to be stored in the table.

    Does anyone have any ideas? The data being passed definitely has the right format (i.e. the control on FormA should easily be able to accept the data). I have been in the debugger, and the error is occuring right on the line

    Me.EventNo = Me.OpenArgs

    in FormA's OnOpen event and OpenArgs does, indeed, have the correct value (EventNo is the name of the receiving control).

    Thanks for any help you can give.

    - Chris

  2. #2
    Join Date
    Aug 2002
    Location
    Northampton, England
    Posts
    266
    Chris, you will get this error message if the table that is the source for FormA, the second form, has AutoNumber set.


    David

  3. #3
    Join Date
    Oct 2002
    Posts
    9
    Well, I believe you that this is the case, but the field to which the control is bound is not an AutoNumber, just a text field. Any other ideas?

    - Chris

    Originally posted by DJN
    Chris, you will get this error message if the table that is the source for FormA, the second form, has AutoNumber set.


    David

  4. #4
    Join Date
    Oct 2002
    Posts
    9

    Talking SOLVED

    Ok, I fixed it. I figured it out after doing what I should have done in the first place: typing the error into google and seeing what comes up (the answer was in the dBforums archive, actually).

    While the problem persistently occurred when I had the code in the OnOpen event of the form, it works perfectly when I place it in the OcCurrent event of the form.
    I also have to be sure to initialize the receiving control to any old value before assigning it the value from OpenArgs.

    I'm sure that if I knew anything about MS Access then this would have been obvious... but I was kind of thrown into a "make a database in the Philippines in 6 months" situation... so I'm only learning as much as necessary (my design should be amazing, huh).

    - Chris
    Last edited by lgmb_0t1; 10-18-02 at 00:50.

Posting Permissions

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