Assigning OpenArgs to field error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

On the BeforeUpdate event of the main form I have:

DoCmd.OpenForm "frmTransaction", , , , acFormAdd, , Me.EmployeeNum

In the form_Open of the frmTransaction I have:

Me.EmployeeNum.Value = Forms!frmTransaction.OpenArgs

but I get a run-time error 2448: You can't assign a value to this object.
What is wrong?

You all have been great in helping me solve all sorts of problems. I know I
won't be disappointed. Thanks in advance!
 
Is EmployeeNum an autonumber? If so, you won't be able to assign a value.

Is is a calculated expresssion? Bound to a calculated query field?

Is the source for the form a read-only query?

Is the record in your current form saved? Is EmployeeNum assigned? Might it
be null, e.g. if the form was at a new record?

Was frmTransaction already open? If so, the OpenArgs will be the one from
when it is originally opened, so may be a null or zero-length string or
other value that cannot be assigned to a number.

Does frmTransaction have its AllowAdditions property set to no?

That should be enough for starters, but that's the kind of thing you are
looking for.
 
kdw said:
On the BeforeUpdate event of the main form I have:

DoCmd.OpenForm "frmTransaction", , , , acFormAdd, , Me.EmployeeNum

In the form_Open of the frmTransaction I have:

Me.EmployeeNum.Value = Forms!frmTransaction.OpenArgs

but I get a run-time error 2448: You can't assign a value to this
object. What is wrong?

You all have been great in helping me solve all sorts of problems. I
know I won't be disappointed. Thanks in advance!

The form's Open event is too soon to assign a value to one of its bound
controls. Move that line of code to the form's Load event. If it
doesn't work there, then check out the other areas Allen Browne
suggested.
 
This solved the problem. I did go through the suggestions that Allen made as
well but my problem wasn't a result of any of those areas. Nevertheless, I
now know what to keep watching out for. Thank you both.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top