Opening a form from a notinlist event

  • Thread starter Thread starter SAC
  • Start date Start date
S

SAC

2000

I'd like to open a form from a not inlist event and enter in data from the
old form into the new form automatically.

How can I do this? Openargs? Does this just handle one value?

Thanks.
 
2000

I'd like to open a form from a not inlist event and enter in data from the
old form into the new form automatically.

How can I do this? Openargs? Does this just handle one value?

Openargs is the way to go. It handles just one string value, but that
value can be lengthy and can contain multiple "values", for instance
delimited by ~ or some other suitable character; in the target form's
Open event you can pick it apart.
 
Great idea! Thanks!
John Vinson said:
Openargs is the way to go. It handles just one string value, but that
value can be lengthy and can contain multiple "values", for instance
delimited by ~ or some other suitable character; in the target form's
Open event you can pick it apart.
 
When I try this it says I can't assign a value to this object.

the syntax I'm using is

me!partno = strPartNo

strPartno is the the Part No part of the OpenArgs.

Thanks.
 
When I try this it says I can't assign a value to this object.

the syntax I'm using is

me!partno = strPartNo

strPartno is the the Part No part of the OpenArgs.

I wasn't very clear: OpenArgs doesn't have "parts". It's just a text
string; you will need to construct the "parts" on your own.

Perhaps you could post the code that you're using to call the form,
and the relevant portion of the form's Open event.
 
Thanks.

Here's the code for opening the form. This isn't the problem, though as the
form open and the openargs string is available:

DoCmd.OpenForm "frmToolsAdd", acNormal, , , acFormAdd, , strArg

Here's the code in the On Open Event of the "frmToolsAdd" form to see if I
can put the OpenArgs string into a control on the form:

Me!txtPartNo = Me.OpenArgs


Once this works, then I'll make strArgs a combo of several strings and break
them out in the new form.

Thanks!
 
I almost got it to work to work perfectly!

I used the On_Load event and it loads the controls (not sure why on_load
works and on_Open doesn't), but it comes of with the error:

"The text you entered is not an item in the list"

How can I get rid of this?

Thanks!
 
Also, after I close the frmToolsAdd form (after adding a new newcord), the
combo box from the original record has not been requeried so it still
doesn't know the existence of the new record. (It still aks me if I want to
add a new record.)

I checked and the Response = acDataErrAdded in the original combo box's
NotInList Event and it is triggered before the new record is added.

How can I make the combo box aware of the new record.?

Thanks.
 
I almost got it to work to work perfectly!

I used the On_Load event and it loads the controls (not sure why on_load
works and on_Open doesn't), but it comes of with the error:

My mistake: the form's Open event fires before the controls are
created (basically, I guess, so that you can cancel the open and not
waste time loading them); the Load event fires afterward.
"The text you entered is not an item in the list"

How can I get rid of this?

Care to post the code? It sounds like you're trying to set the value
of a nonexistant control; check the control names against your code.
 
Also, after I close the frmToolsAdd form (after adding a new newcord), the
combo box from the original record has not been requeried so it still
doesn't know the existence of the new record. (It still aks me if I want to
add a new record.)

I checked and the Response = acDataErrAdded in the original combo box's
NotInList Event and it is triggered before the new record is added.

How can I make the combo box aware of the new record.?

You should open the form in Dialog mode - doing so stops the execution
of the code in the calling form until you close the dialog form. As it
is, the NotInList code continues to run and exits, before the new
record has been created.
 
PERFECT!!!

Thanks!

John Vinson said:
You should open the form in Dialog mode - doing so stops the execution
of the code in the calling form until you close the dialog form. As it
is, the NotInList code continues to run and exits, before the new
record has been created.
 
Back
Top