473,326 Members | 2,095 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Build a reference to a control on the fly

Rob
THere must be an easy way to do the following, but I'm drawing a
blank.

I have 2 forms frmA and frmB. I double click on a text box in frmA
and open frmB. In frmB, I select an item and close. On the close
button I stuff the selected value back into the text box on frmA via.
I need to make frmB generic so it can stuff its value back into the
same type of text box on MANY different forms in my app. I pass in
the name of the calling form via OpenArgs tp frmB.

This works fine in frmB when frmA is not a subform:

Forms(Me.OpenArgs).ActiveControl.Value = me.ID

But I need to be able to do this from a subform.
When sfrmA is a subform, I can't figure out a way to let frmB find the
control on subform sfrmA to stuff the value into:

Hardcoded, this works fine:

Forms!mfrmA!sfrmA.Form!myID = Me.ID

But I can't find a way to pass in (essentially) this string
"Forms!mfrmA!sfrmA.Form!myID" and Assign Me.ID to it generically.

Any help would be greatly appreciated!!
Thanks,
Rob
Nov 13 '05 #1
4 1713
before opening frmB, set a global variable, as follows

set gAcCtlStuffResultInto = Screen.ActiveForm.ActiveControl

then, in frmB, use the following

gAcCtlStuffResultInto.value = me.ID


"Rob" <si****@ensco.com> wrote in message
news:bd************************@posting.google.com ...
THere must be an easy way to do the following, but I'm drawing a
blank.

I have 2 forms frmA and frmB. I double click on a text box in frmA
and open frmB. In frmB, I select an item and close. On the close
button I stuff the selected value back into the text box on frmA via.
I need to make frmB generic so it can stuff its value back into the
same type of text box on MANY different forms in my app. I pass in
the name of the calling form via OpenArgs tp frmB.

This works fine in frmB when frmA is not a subform:

Forms(Me.OpenArgs).ActiveControl.Value = me.ID

But I need to be able to do this from a subform.
When sfrmA is a subform, I can't figure out a way to let frmB find the
control on subform sfrmA to stuff the value into:

Hardcoded, this works fine:

Forms!mfrmA!sfrmA.Form!myID = Me.ID

But I can't find a way to pass in (essentially) this string
"Forms!mfrmA!sfrmA.Form!myID" and Assign Me.ID to it generically.

Any help would be greatly appreciated!!
Thanks,
Rob

Nov 13 '05 #2
Rob
I'll try that, but in the meantime, what is the variable type of the variable

gAcCtlStuffResultInto

??
Thanks
"Malcolm Cook" <me*@stowers-institute.org> wrote in message news:<6n**************@news.more.net>...
before opening frmB, set a global variable, as follows

set gAcCtlStuffResultInto = Screen.ActiveForm.ActiveControl

then, in frmB, use the following

gAcCtlStuffResultInto.value = me.ID


"Rob" <si****@ensco.com> wrote in message
news:bd************************@posting.google.com ...
THere must be an easy way to do the following, but I'm drawing a
blank.

I have 2 forms frmA and frmB. I double click on a text box in frmA
and open frmB. In frmB, I select an item and close. On the close
button I stuff the selected value back into the text box on frmA via.
I need to make frmB generic so it can stuff its value back into the
same type of text box on MANY different forms in my app. I pass in
the name of the calling form via OpenArgs tp frmB.

This works fine in frmB when frmA is not a subform:

Forms(Me.OpenArgs).ActiveControl.Value = me.ID

But I need to be able to do this from a subform.
When sfrmA is a subform, I can't figure out a way to let frmB find the
control on subform sfrmA to stuff the value into:

Hardcoded, this works fine:

Forms!mfrmA!sfrmA.Form!myID = Me.ID

But I can't find a way to pass in (essentially) this string
"Forms!mfrmA!sfrmA.Form!myID" and Assign Me.ID to it generically.

Any help would be greatly appreciated!!
Thanks,
Rob

Nov 13 '05 #3
Rob
I get an "object does not support this property or method" error.
Any ideas?

"Malcolm Cook" <me*@stowers-institute.org> wrote in message news:<6n**************@news.more.net>...
before opening frmB, set a global variable, as follows

set gAcCtlStuffResultInto = Screen.ActiveForm.ActiveControl

then, in frmB, use the following

gAcCtlStuffResultInto.value = me.ID


"Rob" <si****@ensco.com> wrote in message
news:bd************************@posting.google.com ...
THere must be an easy way to do the following, but I'm drawing a
blank.

I have 2 forms frmA and frmB. I double click on a text box in frmA
and open frmB. In frmB, I select an item and close. On the close
button I stuff the selected value back into the text box on frmA via.
I need to make frmB generic so it can stuff its value back into the
same type of text box on MANY different forms in my app. I pass in
the name of the calling form via OpenArgs tp frmB.

This works fine in frmB when frmA is not a subform:

Forms(Me.OpenArgs).ActiveControl.Value = me.ID

But I need to be able to do this from a subform.
When sfrmA is a subform, I can't figure out a way to let frmB find the
control on subform sfrmA to stuff the value into:

Hardcoded, this works fine:

Forms!mfrmA!sfrmA.Form!myID = Me.ID

But I can't find a way to pass in (essentially) this string
"Forms!mfrmA!sfrmA.Form!myID" and Assign Me.ID to it generically.

Any help would be greatly appreciated!!
Thanks,
Rob

Nov 13 '05 #4
si****@ensco.com (Rob) wrote in message news:<bd************************@posting.google.co m>...
I'll try that, but in the meantime, what is the variable type of the variable

gAcCtlStuffResultInto

??
Thanks


a control... that's about as clear as mud...

dim ctl as Control

set ctl = me!mslbxMultiSelect
....
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: SteveB | last post by:
Being a C++ developer, I'm not used to a build performing automagically. For instance, App.config automatically being renamed and placed in the bin\debug folder and project.en-US.resx resource files...
3
by: clintonG | last post by:
Please provide your article reference(s) that document how to use DNF 1.1 panel controls to build a Wizard. I've seen and tried out the DNF 2.0 Wizard Control, I don't like the current...
6
by: Willie wjb | last post by:
Hi, i have a solution with 4 projects sdk, control1, control2 and controls the sdk is the base control1 uses the sdk control2 uses the sdk controls uses the sdk,control1 and control2
2
by: Lisa Calla | last post by:
My aspnet web was working perfectly fine, then I added a second datalist to a page. The datalist can be formatted in the designer and everything looks fine. In the codefile, I can see the...
1
by: tony | last post by:
Hello! I just want to find out how the system find the name to set on a assembly User control dll. I have done this. 1. Create a user control - Here the namespace was set by the system to...
1
by: mndang | last post by:
Hi All, This may have been posted before and such, but I tried a few solutions on the web but to no avail. Problem: I have a web projects (not Web Application Project) with many project...
1
by: AlexZh | last post by:
Hi, I'd like to stop command line build by one project build failed. To do that I've created simple AddIn (see code below), that works fine for IDE and does not work for command line. In the AddIn...
3
by: NickP | last post by:
Hi there, Today I try to compile an application of mine and I am getting a whole list of bizaar errors.... ------------------------------------------------ Error 1 The...
2
by: Sebastian Paul | last post by:
Hi, I have a user control (EventStructureSelector) used in another user control (ResultsMenu). The class EventStructureSelector defines a public type (ModeType), that is used for one of its...
7
by: eschneider | last post by:
I have a webservice which every time I build it keeps adding Crystal references into the web.config? <add assembly="CrystalDecisions.Shared, Version=10.2.3600.0, Culture=neutral,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.