If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
surely a form with a ListBox can be used in a query?
Fred and Tina were kind enough to try to help in an earlier thread but
I'm still getting nowhere. I have a simple query that works fine but the user must type in a "Genotype" to display all the records which match this genotype field in the main table. I got all this working from the query wizzard. What I need is to add a ListBox (I don't need a ComboBox I believe -- am I right?) which displays all the available genotypes (available in a separate, presently unused table called Genotype) so the user can first select a Genotype from the list and then get the same display of all the records with this Genotype. I'm following a thick reference book on the subject and I've made a form and added a ListBox to it (unbound, I'm told to use). Problem is that nowhere have I found a clue on how to incorporate this form containing the listbox and fields into the query. I've looked everywhere in the query parts of the book and even tho this info must be there, I haven't stumbled into it. Could someone give me some words which hint as to what steps I should be trying to get this form accepted by the query? Thanks, Rob |
#2
|
|||
|
|||
surely a form with a ListBox can be used in a query?
You would set the criteria of the "Genotype" field to:
Forms!frmMyForm!lboGenotype Substitute your form and control name and make sure the form is open when you run the report/query. -- Duane Hookom MS Access MVP "1.156" wrote in message ... Fred and Tina were kind enough to try to help in an earlier thread but I'm still getting nowhere. I have a simple query that works fine but the user must type in a "Genotype" to display all the records which match this genotype field in the main table. I got all this working from the query wizzard. What I need is to add a ListBox (I don't need a ComboBox I believe -- am I right?) which displays all the available genotypes (available in a separate, presently unused table called Genotype) so the user can first select a Genotype from the list and then get the same display of all the records with this Genotype. I'm following a thick reference book on the subject and I've made a form and added a ListBox to it (unbound, I'm told to use). Problem is that nowhere have I found a clue on how to incorporate this form containing the listbox and fields into the query. I've looked everywhere in the query parts of the book and even tho this info must be there, I haven't stumbled into it. Could someone give me some words which hint as to what steps I should be trying to get this form accepted by the query? Thanks, Rob |
#3
|
|||
|
|||
surely a form with a ListBox can be used in a query?
Duane, thanks a lot for trying to help.
My form is named "frm_G" and the NAME propertyof the listbox is "Genotype". So, in the query criterion under the Genome field I typed Forms!frmfrm_G!lboGenotype! I have the form open and then I run the query. All I get is a box labeled "Enter parameter value" with a single window above which is Forms!frmfrm_G!lboGenotype! Of course I want it to display the form with the listbox so I can select Genotype. Can you tell where I've gone wrong? Thanks again, Rob Duane Hookom wrote: You would set the criteria of the "Genotype" field to: Forms!frmMyForm!lboGenotype Substitute your form and control name and make sure the form is open when you run the report/query. |
#4
|
|||
|
|||
surely a form with a ListBox can be used in a query?
when Duane said "substitute", he meant substitute completely, as
Forms!frm_G!Genotype! hth "1.156" wrote in message ... Duane, thanks a lot for trying to help. My form is named "frm_G" and the NAME propertyof the listbox is "Genotype". So, in the query criterion under the Genome field I typed Forms!frmfrm_G!lboGenotype! I have the form open and then I run the query. All I get is a box labeled "Enter parameter value" with a single window above which is Forms!frmfrm_G!lboGenotype! Of course I want it to display the form with the listbox so I can select Genotype. Can you tell where I've gone wrong? Thanks again, Rob Duane Hookom wrote: You would set the criteria of the "Genotype" field to: Forms!frmMyForm!lboGenotype Substitute your form and control name and make sure the form is open when you run the report/query. |
#5
|
|||
|
|||
surely a form with a ListBox can be used in a query?
Tina, yes that helps. Now I actually get something that looks a lot
like a form pop up when I run the query so something is working better. Unfortunaltely, the form has nothing at all on it -- it's blank. It looks nothing like the design view of the form. I'm closer and will keep trying. Thanks a lot, Rob tina wrote: when Duane said "substitute", he meant substitute completely, as Forms!frm_G!Genotype! hth "1.156" wrote in message ... Duane, thanks a lot for trying to help. My form is named "frm_G" and the NAME propertyof the listbox is "Genotype". So, in the query criterion under the Genome field I typed Forms!frmfrm_G!lboGenotype! I have the form open and then I run the query. All I get is a box labeled "Enter parameter value" with a single window above which is Forms!frmfrm_G!lboGenotype! Of course I want it to display the form with the listbox so I can select Genotype. Can you tell where I've gone wrong? Thanks again, Rob Duane Hookom wrote: You would set the criteria of the "Genotype" field to: Forms!frmMyForm!lboGenotype Substitute your form and control name and make sure the form is open when you run the report/query. |
#6
|
|||
|
|||
surely a form with a ListBox can be used in a query?
On Mon, 31 May 2004 14:41:34 -0500, "1.156" wrote:
Tina, yes that helps. Now I actually get something that looks a lot like a form pop up when I run the query so something is working better. Unfortunaltely, the form has nothing at all on it -- it's blank. It looks nothing like the design view of the form. I'm closer and will keep trying. This will happen when you have a Form bound to a recordset which is a) empty, so you can't see any existing records and b) not updateable, so you can't see the new record either. A form to be used for query criteria should be *unbound* - make sure that its Recordsource property is blank. John W. Vinson[MVP] Come for live chats every Tuesday and Thursday http://go.compuserve.com/msdevapps?loc=us&access=public |
#7
|
|||
|
|||
surely a form with a ListBox can be used in a query?
John, thanks for the help but this form says "unbound" in its window.
But it would be nice to find this Recordsource property but everything I do to find the "properties" of this form I get just a meaningless window with no info- it has a "general" tab and that's all. So I guess I can't be sure if it's unbound or not. I can find loads of properties of tables and queries but not forms. The main problem is that when I run the query I do not see the listbox I need to make the starting selection. All I get is a list of field headings with nothing below them.. Sure wish I could find this simple concept of using a form in a query mentioned in some literature. They go on and on about queries and forms but never a word about how to use a form in a query. Thanks for trying, Rob John Vinson wrote: On Mon, 31 May 2004 14:41:34 -0500, "1.156" wrote: Tina, yes that helps. Now I actually get something that looks a lot like a form pop up when I run the query so something is working better. Unfortunaltely, the form has nothing at all on it -- it's blank. It looks nothing like the design view of the form. I'm closer and will keep trying. This will happen when you have a Form bound to a recordset which is a) empty, so you can't see any existing records and b) not updateable, so you can't see the new record either. A form to be used for query criteria should be *unbound* - make sure that its Recordsource property is blank. John W. Vinson[MVP] Come for live chats every Tuesday and Thursday http://go.compuserve.com/msdevapps?loc=us&access=public |
#8
|
|||
|
|||
surely a form with a ListBox can be used in a query?
On Mon, 31 May 2004 20:41:29 -0500, "1.156" wrote:
John, thanks for the help but this form says "unbound" in its window. I'm not sure what you mean by "its window". But it would be nice to find this Recordsource property but everything I do to find the "properties" of this form I get just a meaningless window with no info- it has a "general" tab and that's all. So I guess I can't be sure if it's unbound or not. I can find loads of properties of tables and queries but not forms. Open the Form in design view. Right mouseclick the little square box at the upper left intersection of the rulers. Select Properties from this dropdown list; the Record Source property is the first one on the Data tab. The main problem is that when I run the query I do not see the listbox I need to make the starting selection. All I get is a list of field headings with nothing below them.. Sure wish I could find this simple concept of using a form in a query mentioned in some literature. They go on and on about queries and forms but never a word about how to use a form in a query. AHA! There's the problem. No, you are doing it reasonably - but backwards. Don't expect the Query to open the form for you; it won't. Instead, *open the Query from the Form*. If it's a select query to display data, it would be best to create a Form (for onscreen use) and/or a Report (for printing) based on the query; put a Command Button on the form to open this Form (or maybe two buttons, one to open the form, one to print the report). If it's an action query, or if (unwisely, IMHO) you want to give the user a query datasheet, you can put a command button to run (open) the query. John W. Vinson[MVP] Come for live chats every Tuesday and Thursday http://go.compuserve.com/msdevapps?loc=us&access=public |
#9
|
|||
|
|||
surely a form with a ListBox can be used in a query?
John, thanks for your continued response. I did find the Record Source
property and there's nothing there so I guess the form is unbound as it should be. You say Instead, *open the Query from the Form*. If it's a select query to display data, it would be best to create a Form (for onscreen use) and/or a Report (for printing) based on the query; put a Command Button on the form to open this Form (or maybe two buttons, one to open the form, one to print the report). I guess it is a 'select' query; I only want to display some records in the main table based on selecting a single field in it. It's hard to imagine a more simple goal and I'm surprised Access doesn't have simple machinery to do it. You say I should put a command button on the form to open this form. I don't follow that. Surely you don't mean the form opens itself -- so you must mean two forms. I only have one as far as I know. I'll start looking up command buttons. Earlier I was told that my query wouldn't open the form so I have it opened in design view when I double click the query in the query list. Thanks again for trying to help. Amazingly, after several months I still can't make a simple query work. Rob John Vinson wrote: On Mon, 31 May 2004 20:41:29 -0500, "1.156" wrote: John, thanks for the help but this form says "unbound" in its window. I'm not sure what you mean by "its window". But it would be nice to find this Recordsource property but everything I do to find the "properties" of this form I get just a meaningless window with no info- it has a "general" tab and that's all. So I guess I can't be sure if it's unbound or not. I can find loads of properties of tables and queries but not forms. Open the Form in design view. Right mouseclick the little square box at the upper left intersection of the rulers. Select Properties from this dropdown list; the Record Source property is the first one on the Data tab. The main problem is that when I run the query I do not see the listbox I need to make the starting selection. All I get is a list of field headings with nothing below them.. Sure wish I could find this simple concept of using a form in a query mentioned in some literature. They go on and on about queries and forms but never a word about how to use a form in a query. AHA! There's the problem. No, you are doing it reasonably - but backwards. Don't expect the Query to open the form for you; it won't. Instead, *open the Query from the Form*. If it's a select query to display data, it would be best to create a Form (for onscreen use) and/or a Report (for printing) based on the query; put a Command Button on the form to open this Form (or maybe two buttons, one to open the form, one to print the report). If it's an action query, or if (unwisely, IMHO) you want to give the user a query datasheet, you can put a command button to run (open) the query. John W. Vinson[MVP] Come for live chats every Tuesday and Thursday http://go.compuserve.com/msdevapps?loc=us&access=public |
#10
|
|||
|
|||
Made some progress but still not there....
I finally pushed the right button and my form now actually displays a
listbox with the proper things to select from. But nothing happens when I click on or highlight my selection. It appears that I need an action from the click event from MyListBox In my query, I have Forms!MyForm!MyListBox in the Criteria line. If this is correct, can someone suggest an event to assign to MyListBox? I think this is all I need to get this simple query to work. Thanks, Rob 1.156 wrote: Fred and Tina were kind enough to try to help in an earlier thread but I'm still getting nowhere. I have a simple query that works fine but the user must type in a "Genotype" to display all the records which match this genotype field in the main table. I got all this working from the query wizzard. What I need is to add a ListBox (I don't need a ComboBox I believe -- am I right?) which displays all the available genotypes (available in a separate, presently unused table called Genotype) so the user can first select a Genotype from the list and then get the same display of all the records with this Genotype. I'm following a thick reference book on the subject and I've made a form and added a ListBox to it (unbound, I'm told to use). Problem is that nowhere have I found a clue on how to incorporate this form containing the listbox and fields into the query. I've looked everywhere in the query parts of the book and even tho this info must be there, I haven't stumbled into it. Could someone give me some words which hint as to what steps I should be trying to get this form accepted by the query? Thanks, Rob |
|
Thread Tools | |
Display Modes | |
|
|