473,545 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing Parameter Problem when using Display Form...

I've got a form - "frmLookup" (with a subform) that works very happily
on its own. The form has a list box, which when updated requeries the
subform to display the appropriate results.

The problem is that for the final user interface, I had planned to use
a "frmDisplay " form which had a number of menu items and then depending
on what the user selected, it would display the appropraite form in a
subform beneath the menu items. I did this mainly for ease of
controlling the window location, less frightening to the user and also
to avoid a mass of pop-ups. However, when I try to display "frmLookup"
in this subform, the subform within "frmLookup" can no longer find the
listbox I referenced as Forms.frmLookup .lstGroup. I couldn't get the
right reference for it to work through the second sub form. Even if I
did, I would like to be able to run "frmLookup" on it's own as well as
through the display subform.

Does anyone have any ideas if this is possible and if so how - I
thought functions might work but didn't have a lot of luck returning a
"lstGroup" value (is that possible from a public function in a module??
Or failing that, what would the correct reference be to reference the
lstbox in "frmLookup" .

Cheers,

Reg

Dec 14 '06 #1
4 2076
okay, for ease of communication, let's forget the frmDisplay for a minute
and speak strictly in the context of frmLookup and its' subform.

if you're working with VBA code (not a macro), and you are in the subform's
module, and you want to refer to the listbox control on the main form
(frmLookup), then use the following syntax, as

Me.Parent!lstGr oup

the above syntax will work even when frmLookup becomes a subform, itself.

however, if you're not referring to lstGroup from within a VBA module, then
you're going to have to refer to lstGroup with the full reference, as

Forms!frmDispla y!SubformContro lName.Form!lstG roup

replace SubformControlN ame with the correct name of the subform control that
"contains" frmLookup, of course. this solution precludes using frmLookup as
a stand-alone form, unfortunately - unless you're using the reference in the
subform itself (not in a macro); then you might be able to use the

Forms!frmLookup !lstGroup

syntax in the subform, and write code in frmDisplay's Load event to change
to the longer reference posted above.

hth
"Regnab" <p.*******@gmai l.comwrote in message
news:11******** **************@ l12g2000cwl.goo glegroups.com.. .
I've got a form - "frmLookup" (with a subform) that works very happily
on its own. The form has a list box, which when updated requeries the
subform to display the appropriate results.

The problem is that for the final user interface, I had planned to use
a "frmDisplay " form which had a number of menu items and then depending
on what the user selected, it would display the appropraite form in a
subform beneath the menu items. I did this mainly for ease of
controlling the window location, less frightening to the user and also
to avoid a mass of pop-ups. However, when I try to display "frmLookup"
in this subform, the subform within "frmLookup" can no longer find the
listbox I referenced as Forms.frmLookup .lstGroup. I couldn't get the
right reference for it to work through the second sub form. Even if I
did, I would like to be able to run "frmLookup" on it's own as well as
through the display subform.

Does anyone have any ideas if this is possible and if so how - I
thought functions might work but didn't have a lot of luck returning a
"lstGroup" value (is that possible from a public function in a module??
Or failing that, what would the correct reference be to reference the
lstbox in "frmLookup" .

Cheers,

Reg

Dec 14 '06 #2
Thanks Tina,

Your suggestion of using Me.Parent!lstGr oup worked a treat when I used
it in a function is the subform's module, and then called it to supply
the default value of one of the text boxes in the sub form (txtGroup).
This doesn't appear to work however when I try to call the function to
supply a criteria in the subfrm's source query. Am I doing something
incorrectly or is it not possible to call a frm specific function from
the query?

Cheers

Reg

tina wrote:
okay, for ease of communication, let's forget the frmDisplay for a minute
and speak strictly in the context of frmLookup and its' subform.

if you're working with VBA code (not a macro), and you are in the subform's
module, and you want to refer to the listbox control on the main form
(frmLookup), then use the following syntax, as

Me.Parent!lstGr oup

the above syntax will work even when frmLookup becomes a subform, itself.

however, if you're not referring to lstGroup from within a VBA module, then
you're going to have to refer to lstGroup with the full reference, as

Forms!frmDispla y!SubformContro lName.Form!lstG roup

replace SubformControlN ame with the correct name of the subform control that
"contains" frmLookup, of course. this solution precludes using frmLookup as
a stand-alone form, unfortunately - unless you're using the reference in the
subform itself (not in a macro); then you might be able to use the

Forms!frmLookup !lstGroup

syntax in the subform, and write code in frmDisplay's Load event to change
to the longer reference posted above.

hth
"Regnab" <p.*******@gmai l.comwrote in message
news:11******** **************@ l12g2000cwl.goo glegroups.com.. .
I've got a form - "frmLookup" (with a subform) that works very happily
on its own. The form has a list box, which when updated requeries the
subform to display the appropriate results.

The problem is that for the final user interface, I had planned to use
a "frmDisplay " form which had a number of menu items and then depending
on what the user selected, it would display the appropraite form in a
subform beneath the menu items. I did this mainly for ease of
controlling the window location, less frightening to the user and also
to avoid a mass of pop-ups. However, when I try to display "frmLookup"
in this subform, the subform within "frmLookup" can no longer find the
listbox I referenced as Forms.frmLookup .lstGroup. I couldn't get the
right reference for it to work through the second sub form. Even if I
did, I would like to be able to run "frmLookup" on it's own as well as
through the display subform.

Does anyone have any ideas if this is possible and if so how - I
thought functions might work but didn't have a lot of luck returning a
"lstGroup" value (is that possible from a public function in a module??
Or failing that, what would the correct reference be to reference the
lstbox in "frmLookup" .

Cheers,

Reg
Dec 14 '06 #3
Been playing around with it a little more and worked out that I can do
it by changing the recordsource of the subform before I requery it from
the the lstGroup AfterUpdate on the "frmLookup" form. Unless there are
better suggestions I'll run with this. Thanks for all your help,

Cheers

Reg

Dec 14 '06 #4
This doesn't appear to work however when I try to call the function to
supply a criteria in the subfrm's source query.
normally, a subform loads *before* its' parent form, so the function call in
the subform's RecordSource query is looking for a mainform control that
isn't "there" yet. you might try assigning the subform's RecordSource
property on frmLookup's Load event. once both subform and mainform are open,
subsequent function calls should work okay without special handling.

if the above suggestion doesn't work for you, suggest you just stick with
the solution you've already set up.

hth
"Regnab" <p.*******@gmai l.comwrote in message
news:11******** **************@ f1g2000cwa.goog legroups.com...
Been playing around with it a little more and worked out that I can do
it by changing the recordsource of the subform before I requery it from
the the lstGroup AfterUpdate on the "frmLookup" form. Unless there are
better suggestions I'll run with this. Thanks for all your help,

Cheers

Reg

Dec 15 '06 #5

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

Similar topics

2
17346
by: zlatko | last post by:
There is a form in an Access Project (.adp, Access front end with SQL Server) for entering data into a table for temporary storing. Then, by clicking a botton, several action stored procedures (update, append) should be activated in order to transfer data to other tables. I tried to avoid any coding in VB, as I am not a professional, but I...
3
14913
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) { document.images.src = eval("mt" +menu+ ".src") } alert("imgOff_hidemenu"); hideMenu=setTimeout('Hide(menu,num)',500);
1
1496
by: Paul Fairless | last post by:
I have a form called frmCustSearch to search for customers against an SQL Server database. The form contains a simple textbox into which the Customers surname is typed, and a datagrid then becomes visible on the form containing the CustID, Surname, Forename and address of all people with that surname. The correct customer is then selected...
1
3855
by: Michael DeLawter | last post by:
Using Access 2002. I have a chart in a report that is currently based on a query in which the user enters the start and end date for the chart to display. Both the start and end dates have been identified as parameters so that the date range can be found without causing an error. So far so good, report works as it should. Here's the...
4
4861
by: Ron Rohrssen | last post by:
I want to show a dialog and when the form (dialog) is closed, return to the calling form. The calling form should then be able to pass the child form to another object with the form as a parameter. For example, FormOptions formOptions = new FormOptions(); if (formOptions.ShowDialog(this) == DialogResult.OK) {
4
2748
by: Ranginald | last post by:
Hi, I'm having trouble passing a parameter from my default.aspx page to my default2.aspx page. I have values from a query in a list box and the goal is to pass the "catID" from default.aspx to a stored procedure on the details2.aspx page. I can successfully pass the values from the listbox control to a
7
2794
by: Jason | last post by:
Hello I've got a very simple C# app, that has a datagrid, a text box, and a button which when clicked opens a second form... Form2 frm2 = new Form2(); frm2.Show(); When I place a datagrid, onto form1 I point to a DB called Test DB and then my text box, I modify the databinding property to my bindingSource which in
1
3452
by: grabit | last post by:
Hi Peoples i have a search page with a form field "subject" on my results page i have a paging routine . the first page lists its 10 records no trouble but when i click the "next" link i get a error telling me "subject is not defined in form" How can i overcome this please. I will post the page down to the end of the paging routine coz its not...
5
8498
by: jaynea | last post by:
Hi I have a main form which contains questions and a subform within it which contains elements which relate to the main form. they are linked by a field called question_ref so if I page through the records on the main form the elements that are relevant to that question display in the subform. Within the subform I have a combo box which calls...
0
7411
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7669
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7439
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7773
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3468
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.