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).
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).