473,385 Members | 1,647 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,385 software developers and data experts.

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 2065
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!lstGroup

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!frmDisplay!SubformControlName.Form!lstGroup

replace SubformControlName 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.*******@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.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!lstGroup 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!lstGroup

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!frmDisplay!SubformControlName.Form!lstGroup

replace SubformControlName 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.*******@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.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.*******@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.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
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...
3
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) {...
1
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...
1
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...
4
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...
4
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...
7
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,...
1
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...
5
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.