Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform Not In List Event

Status
Not open for further replies.

dynamictiger

Technical User
Dec 14, 2001
206
AU
I have made a form to handle not in list events. It works fantastic until I hit a subform.

The procedure works by setting properties in the calling form for the the recordsource of the combobox and the field we are trying to add new data too. The newdata and the formname are passed as openArgs.

As you can see my problem is that the subform Me.Name property returns the form name of the subform not the name the subform is opened by. I have tried playing around with string expressions to make this work for a subform but don't seem to be able to get the correct syntax.

Anyone got a better idea?
 
Since you're passing a form name, I assume your NotInList form accesses the calling form using the Forms collection. That's not going to work for a subform, because it isn't in the Forms collection.

I think what I would do is abandon using OpenArgs. Instead, create some Public module-level variables in a standard module, and use them to pass the newdata (a string) and a reference to the form (Dim frmCaller As Form). The calling form then just does Set frmCaller = Me, whether it's a main form or a subform. In the NotInList form, you reference the properties and controls as frmCaller.RecordSource, frmCaller!Combo1, etc.

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top