473,466 Members | 1,346 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

listboxes and setting selection as criteria

58 New Member
Does anyone know how to do this?

I want to create 2 listboxes. Each listbox must contain a column from a table that has been imported. Example for the 1st listbox:

288394 CALVIN KLEIN ESCAPE (500mL)
239484 HUGO BOSS (650mL)
874257 JEANPAULG (500mL) ..and so on

The second listbox must contain Cities. (also taken from a table made in excel)

Now, I want to be able to choose a product, choose a specific city, and press a command button so it will direct me to a screen that lets me know how much of that product was ordered or sold in that particular city.

any suggestions ?
May 8 '07 #1
52 3635
JConsulting
603 Recognized Expert Contributor
Begin by using the listbox wizard. It will walk you through creating exactly what you want for your listboxes.

If you plan to use these listboxes as a kind of a filter or criteria for a select query (for your form) then you want to be sure that you only allow a single select, otherwise there's coding involved.

If you already have a query that you want to build your form on, then paste that here and we'll assist you in setting it up to use your new listboxes.
J
May 8 '07 #2
dbruzzese84
58 New Member
how do i do that?
May 8 '07 #3
dbruzzese84
58 New Member
my listboxes are set up, but i dont know how to create a button that returns information. example, if you clicked 432489 calvin klein in 1 box, and then calgary in another, then click search.. i want the search to come up with the results of all the orders of 432489 calvin klein in calgary.
May 8 '07 #4
JConsulting
603 Recognized Expert Contributor
how do i do that?
Which part.

This is the Listbox part

Using the Access Toolbar, you select the Listbox control. Select it then go down into your form and click on it. The listbox will be added to your form and the wizard will open.

It will ask you what you want to use for the rowsource. Select either your table, or if you have a query, use that.

It will prompt you to add the fields from your previous selection.

Follow the prompts.

J
May 8 '07 #5
JConsulting
603 Recognized Expert Contributor
my listboxes are set up, but i dont know how to create a button that returns information. example, if you clicked 432489 calvin klein in 1 box, and then calgary in another, then click search.. i want the search to come up with the results of all the orders of 432489 calvin klein in calgary.
do you have a query built already that has the fields you want returned in it? If not, you need to create one.

There is a row inside the query builder grid called Criteria. It's there you need to reference your listbox by name.

Can you tell me what the "bound" columns are for your listboxes?

The bound column defaults to 1....so that would be the first field listed in your rowsource.

it's those fields that we'll put criteria into in your query.
J
May 8 '07 #6
dbruzzese84
58 New Member
ok my listboxes are set up. and a query is built. what do i type in the criteria line?
May 8 '07 #7
dbruzzese84
58 New Member
they are both "1" in the bound
May 8 '07 #8
JConsulting
603 Recognized Expert Contributor
they are both "1" in the bound
in the criteria fields in your query...reference your form

forms!yourformname!yourlistboxname

you'll use that for both fields that you're filtering.

create a button to run your query

Docmd.OpenQuery "yourqueryname"

Now when the query opens, it is filtered using your entries.

PS I got your PM..if you can't get this to work..then we'll go that route.
J
May 8 '07 #9
dbruzzese84
58 New Member
in the criteria fields in your query...reference your form

forms!yourformname!yourlistboxname

you'll use that for both fields that you're filtering.

create a button to run your query

Docmd.OpenQuery "yourqueryname"

Now when the query opens, it is filtered using your entries.

PS I got your PM..if you can't get this to work..then we'll go that route.
J
its asking me to enter data. i dont want to type in data. i want to be able to click an entry in the listbox and press the command button. the command [forms]![frmForm1]![lstlist0] doesnt work.
May 9 '07 #10
JConsulting
603 Recognized Expert Contributor
its asking me to enter data. i dont want to type in data. i want to be able to click an entry in the listbox and press the command button. the command [forms]![frmForm1]![lstlist0] doesnt work.
can you paste in the SQL from your query please
May 9 '07 #11
JConsulting
603 Recognized Expert Contributor
can you paste in the SQL from your query please
can you also paste in the ROWSOURCE of your listbox
May 9 '07 #12
dbruzzese84
58 New Member
can you also paste in the ROWSOURCE of your listbox
i am kind of an access "newb", how would i go about copying and pasting my query to SQL?
May 9 '07 #13
dbruzzese84
58 New Member
like this?

SELECT SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
FROM LSList INNER JOIN SalesLic952 ON LSList.LIC_NO = SalesLic952.CUSTOMER
ORDER BY SalesLic952.CSPC, LSList.CITY;



SELECT [CSPC_LIST].[CSPC] FROM CSPC_LIST; <--rowsource for the 1st listbox containing the products

SELECT [LSList].[ID], [LSList].[CITY] FROM LSList; <-rowsource from 2nd listbox containing the cities.
May 9 '07 #14
dbruzzese84
58 New Member
forms!yourformname!yourlistboxname

forms!frmForm1!lstList1 <-- this command line shows up in a textbox that asks me to enter data once the command button is clicked. if i type in the product number and city, it will work, but i want it to recognize that each entry in the listbox means something.
May 9 '07 #15
JConsulting
603 Recognized Expert Contributor
forms!yourformname!yourlistboxname

forms!frmForm1!lstList1 <-- this command line shows up in a textbox that asks me to enter data once the command button is clicked. if i type in the product number and city, it will work, but i want it to recognize that each entry in the listbox means something.
Replace the SQL with this. I had to add the ID field to it...and the where clause.

Expand|Select|Wrap|Line Numbers
  1. SELECT [LSList].[ID], SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  2. FROM LSList INNER JOIN SalesLic952 ON LSList.LIC_NO = SalesLic952.CUSTOMER
  3. ORDER BY SalesLic952.CSPC, LSList.CITY where SalesLic952.CSPC = nz(forms!frmForm1!lstList1,SalesLic952.CSPC) and [LSList].[ID] = nz(forms!frmForm1!lstList2, [LSList].[ID]);
  4.  
  5.  
May 9 '07 #16
dbruzzese84
58 New Member
Replace the SQL with this. I had to add the ID field to it...and the where clause.

Expand|Select|Wrap|Line Numbers
  1. SELECT [LSList].[ID], SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  2. FROM LSList INNER JOIN SalesLic952 ON LSList.LIC_NO = SalesLic952.CUSTOMER
  3. ORDER BY SalesLic952.CSPC, LSList.CITY where SalesLic952.CSPC = nz(forms!frmForm1!lstList1,SalesLic952.CSPC) and [LSList].[ID] = nz(forms!frmForm1!lstList2, [LSList].[ID]);
  4.  
  5.  
its not working. missing operators. is there anyway u can create a 2 line excel sheet, import it into access, create what im talking about and send it? it would be much easier for my to look at something.
May 9 '07 #17
JConsulting
603 Recognized Expert Contributor
its not working. missing operators. is there anyway u can create a 2 line excel sheet, import it into access, create what im talking about and send it? it would be much easier for my to look at something.
try taking the SQL you sent prior to my reply...and where you have your table name...surround it in brackets.

My Test should be [My test]

Same for any field you have in the SQL that has a space in it.

Also, take a look at the Left, Instr and Mid functions in your Access Help.

I could do this for you (and have actually) but you wont learn it that way.

I also don't have a way to download a "spreadsheet", because I'm at work and that's not allowed. So I apologise, as I can't assist you that way.

J
May 9 '07 #18
dbruzzese84
58 New Member
My tables are:

CITY
(field names:ID, CITY)

CSPC_LIST
(field names: ID, CSPC)

LSList
(field names: ID, LIC_NO, NAME, PHONE, FAX, ADDRESS, MAILING ADDRESS, CITY, POSTAL CODE)

SalesLic952
(field names: ID, CSPC, DESCRIPTION, SIZE, UNITS, QTY, UOM, CUSTOMER, NAME)

Form name is Form1
Listbox w/CSPC is List0
Listbox w/City is List1
May 9 '07 #19
JConsulting
603 Recognized Expert Contributor
My tables are:

CITY
(field names:ID, CITY)

CSPC_LIST
(field names: ID, CSPC)

LSList
(field names: ID, LIC_NO, NAME, PHONE, FAX, ADDRESS, MAILING ADDRESS, CITY, POSTAL CODE)

SalesLic952
(field names: ID, CSPC, DESCRIPTION, SIZE, UNITS, QTY, UOM, CUSTOMER, NAME)

Form name is Form1
Listbox w/CSPC is List0
Listbox w/City is List1

give this a go

Expand|Select|Wrap|Line Numbers
  1. SELECT [LSList].[ID], SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  2. FROM LSList INNER JOIN SalesLic952 ON LSList.LIC_NO = SalesLic952.CUSTOMER where SalesLic952.CSPC = nz(forms!frmForm1!lstList1,SalesLic952.CSPC) and [LSList].[ID] = nz(forms!frmForm1!lstList2, [LSList].[ID])
  3. ORDER BY SalesLic952.CSPC, LSList.CITY;
  4.  
May 9 '07 #20
dbruzzese84
58 New Member
give this a go

Expand|Select|Wrap|Line Numbers
  1. SELECT [LSList].[ID], SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  2. FROM LSList INNER JOIN SalesLic952 ON LSList.LIC_NO = SalesLic952.CUSTOMER where SalesLic952.CSPC = nz(forms!frmForm1!lstList1,SalesLic952.CSPC) and [LSList].[ID] = nz(forms!frmForm1!lstList2, [LSList].[ID])
  3. ORDER BY SalesLic952.CSPC, LSList.CITY;
  4.  
ok this one has no errors, but it is still prompting me to enter something in an input box.
May 9 '07 #21
dbruzzese84
58 New Member
ok this one has no errors, but it is still prompting me to enter something in an input box.
maybe my relationships are wrong?
May 9 '07 #22
dbruzzese84
58 New Member



this is what it needs to look like. In available columns, City should be added
May 9 '07 #23
dbruzzese84
58 New Member
the input box says "Enter Parameter Value"
May 9 '07 #24
JConsulting
603 Recognized Expert Contributor
the input box says "Enter Parameter Value"
SELECT [LSList].[ID], SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
FROM LSList INNER JOIN SalesLic952 ON LSList.LIC_NO = SalesLic952.CUSTOMER where SalesLic952.CSPC = nz(forms!frmForm1!lstList1,"SalesLic952.CSPC") and [LSList].[ID] = nz(forms!frmForm1!lstList2, "[LSList].[ID]")
ORDER BY SalesLic952.CSPC, LSList.CITY;
May 9 '07 #25
dbruzzese84
58 New Member
That will probably work, I hate wasting your time like this. I am going to start over. See the problem I am having as well is that most of the fields are repeating themselves. i need them to just show up once. Calgary is listed 60times. Is there an easier way to do this? step by step from the beginning kinda thing?
May 9 '07 #26
JConsulting
603 Recognized Expert Contributor
That will probably work, I hate wasting your time like this. I am going to start over. See the problem I am having as well is that most of the fields are repeating themselves. i need them to just show up once. Calgary is listed 60times. Is there an easier way to do this? step by step from the beginning kinda thing?
starting over? lol

Expand|Select|Wrap|Line Numbers
  1. SELECT [LSList].[ID], SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  2. FROM LSList INNER JOIN SalesLic952 ON LSList.LIC_NO = SalesLic952.CUSTOMER 
  3. ORDER BY [LSList].[ID], SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  4. HAVING SalesLic952.CSPC = nz(forms!frmForm1!lstList1,SalesLic952.CSPC) and [LSList].[ID] = nz(forms!frmForm1!lstList2, [LSList].[ID])
  5. ORDER BY SalesLic952.CSPC, LSList.CITY;
  6.  
May 9 '07 #27
dbruzzese84
58 New Member
starting over? lol

Expand|Select|Wrap|Line Numbers
  1. SELECT [LSList].[ID], SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  2. FROM LSList INNER JOIN SalesLic952 ON LSList.LIC_NO = SalesLic952.CUSTOMER 
  3. ORDER BY [LSList].[ID], SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  4. HAVING SalesLic952.CSPC = nz(forms!frmForm1!lstList1,SalesLic952.CSPC) and [LSList].[ID] = nz(forms!frmForm1!lstList2, [LSList].[ID])
  5. ORDER BY SalesLic952.CSPC, LSList.CITY;
  6.  
check PM please
May 9 '07 #28
JConsulting
603 Recognized Expert Contributor
check PM please
Not sure what that means...do you wish a Moderator to view the question?
May 9 '07 #29
JConsulting
603 Recognized Expert Contributor
That will probably work, I hate wasting your time like this. I am going to start over. See the problem I am having as well is that most of the fields are repeating themselves. i need them to just show up once. Calgary is listed 60times. Is there an easier way to do this? step by step from the beginning kinda thing?
Adding a group by statement to the query tells it to not display duplicate values for the fields included in the list.

If this doesn't help...please explain how you would like to approach the issue.
J
May 9 '07 #30
JConsulting
603 Recognized Expert Contributor
check PM please

aaah, I see that instead of Group By...I had order by. Please..try this again.

Expand|Select|Wrap|Line Numbers
  1. SELECT [LSList].[ID], SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  2. FROM LSList INNER JOIN SalesLic952 ON LSList.LIC_NO = SalesLic952.CUSTOMER 
  3. Group BY [LSList].[ID], SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  4. HAVING SalesLic952.CSPC = nz(forms!frmForm1!lstList1,SalesLic952.CSPC) and [LSList].[ID] = nz(forms!frmForm1!lstList2, [LSList].[ID])
  5. ORDER BY SalesLic952.CSPC, LSList.CITY;
  6.  
May 9 '07 #31
dbruzzese84
58 New Member
This is what happens when the comman button is clicked:



Also, do you see all the duplicate CSPC numbers and cities? I only want one of each.
May 9 '07 #32
JConsulting
603 Recognized Expert Contributor
This is what happens when the comman button is clicked:



Also, do you see all the duplicate CSPC numbers and cities? I only want one of each.
>>This is what happens when the comman button is clicked:

what happens?

Also...is there a reason you included the ID in with your listbox 2?
what are you trying to filter...just by city name right?
May 9 '07 #33
dbruzzese84
58 New Member
>>This is what happens when the comman button is clicked:

what happens?

Also...is there a reason you included the ID in with your listbox 2?
what are you trying to filter...just by city name right?
can you not see the image i posted? i took a snapshot of my screen. i dont want an input box titled "enter parameter" to show up. cant it just generate the results? im filtering by CSPC and CITY
May 10 '07 #34
dbruzzese84
58 New Member
>>This is what happens when the comman button is clicked:

what happens?

Also...is there a reason you included the ID in with your listbox 2?
what are you trying to filter...just by city name right?
can you not see the image i posted? i took a snapshot of my screen. i dont want an input box titled "enter parameter" to show up. cant it just generate the results? im filtering by CSPC and CITY
May 10 '07 #35
MMcCarthy
14,534 Recognized Expert Moderator MVP
can you not see the image i posted? i took a snapshot of my screen. i dont want an input box titled "enter parameter" to show up. cant it just generate the results? im filtering by CSPC and CITY
When you are running your query the form has to be open with the listboxes selected.

If you want a distinct list of cities then

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT CityField FROM TableName
Mary
May 10 '07 #36
JConsulting
603 Recognized Expert Contributor
can you not see the image i posted? i took a snapshot of my screen. i dont want an input box titled "enter parameter" to show up. cant it just generate the results? im filtering by CSPC and CITY
Thank you Mary,

dbruzzese84,
No, I can't see it. Sorry.

I did ask if there was a reason you included the ID field in with your city list. The reason you're having issues is it's looking at the ID instead of the city name.


Hopefully Mary's post helped you out.
J
May 10 '07 #37
dbruzzese84
58 New Member
Thank you Mary,

dbruzzese84,
No, I can't see it. Sorry.

I did ask if there was a reason you included the ID field in with your city list. The reason you're having issues is it's looking at the ID instead of the city name.


Hopefully Mary's post helped you out.
J
is there anyway i can start over and begin a fresh db? everything seems mixed up in this db now. can you give me step by step instructions over the phone? email? whatever is easier.
May 10 '07 #38
JConsulting
603 Recognized Expert Contributor
is there anyway i can start over and begin a fresh db? everything seems mixed up in this db now. can you give me step by step instructions over the phone? email? whatever is easier.
dbruzzese84,
This forum is to assist you with issues you encounter during your development efforts. We all volunteer here assisting with questions like yours. In our private lives, most, if not all of us do this kind of work for a living, meaning, we get paid to design databases.

I understand your frustration when it comes time to communicate your needs, and have us respond as you would like. Who wouldn't want a Free consultant to call up when we have an issue that can walk us through, step by step until we get it right...then we would either get an A in our class, or a paycheck from our employer and pass off someone elses work as our own. I want that!!

If you go back to your first entry. You asked if you could have help making two listboxes.

you created these

Expand|Select|Wrap|Line Numbers
  1. SELECT [CSPC_LIST].[CSPC] FROM CSPC_LIST; <--rowsource for the 1st listbox containing the products
  2.  
  3. SELECT [LSList].[ID], [LSList].[CITY] FROM LSList; <-rowsource from 2nd listbox containing the cities.
  4.  
What you encountered was duplicate entries in your CSPC listbox.

You need to edit it like this
Expand|Select|Wrap|Line Numbers
  1. SELECT [CSPC_LIST].[CSPC] FROM CSPC_LIST Group By CSPC;
  2.  
That will get rid of the duplicate entries.

your second box...you have an ID field in there...it needs to go away. So you need to edit the second box like this.
Expand|Select|Wrap|Line Numbers
  1. SELECT [LSList].[CITY] FROM LSList group by [City];
  2.  
Then also on the second box...you need to change the column count to 1 and you need to change the column widths to account for only 1 column.

Now, in your query you need to make these changes

Expand|Select|Wrap|Line Numbers
  1. SELECT SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  2. FROM LSList INNER JOIN SalesLic952 ON LSList.LIC_NO = SalesLic952.CUSTOMER
  3. ORDER BY SalesLic952.CSPC, LSList.CITY where SalesLic952.CSPC = nz(forms!frmForm1!lstList1, "SalesLic952.CSPC") and [LSList].[City] = nz(forms!frmForm1!lstList2, "[LSList].[City]");
  4.  
Again, I understand your frustration. But please do not consider my help as any kind of obligation. I am helping you because I want to. I do not want to have a phone conversation, nor do I wish to exchange e-mails...As those to me are considered billable in my profession.

Sincerely,
J
May 10 '07 #39
dbruzzese84
58 New Member
dbruzzese84,
This forum is to assist you with issues you encounter during your development efforts. We all volunteer here assisting with questions like yours. In our private lives, most, if not all of us do this kind of work for a living, meaning, we get paid to design databases.

I understand your frustration when it comes time to communicate your needs, and have us respond as you would like. Who wouldn't want a Free consultant to call up when we have an issue that can walk us through, step by step until we get it right...then we would either get an A in our class, or a paycheck from our employer and pass off someone elses work as our own. I want that!!

If you go back to your first entry. You asked if you could have help making two listboxes.

you created these

Expand|Select|Wrap|Line Numbers
  1. SELECT [CSPC_LIST].[CSPC] FROM CSPC_LIST; <--rowsource for the 1st listbox containing the products
  2.  
  3. SELECT [LSList].[ID], [LSList].[CITY] FROM LSList; <-rowsource from 2nd listbox containing the cities.
  4.  
What you encountered was duplicate entries in your CSPC listbox.

You need to edit it like this
Expand|Select|Wrap|Line Numbers
  1. SELECT [CSPC_LIST].[CSPC] FROM CSPC_LIST Group By CSPC;
  2.  
That will get rid of the duplicate entries.

your second box...you have an ID field in there...it needs to go away. So you need to edit the second box like this.
Expand|Select|Wrap|Line Numbers
  1. SELECT [LSList].[CITY] FROM LSList group by [City];
  2.  
Then also on the second box...you need to change the column count to 1 and you need to change the column widths to account for only 1 column.

Now, in your query you need to make these changes

Expand|Select|Wrap|Line Numbers
  1. SELECT SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  2. FROM LSList INNER JOIN SalesLic952 ON LSList.LIC_NO = SalesLic952.CUSTOMER
  3. ORDER BY SalesLic952.CSPC, LSList.CITY where SalesLic952.CSPC = nz(forms!frmForm1!lstList1, "SalesLic952.CSPC") and [LSList].[City] = nz(forms!frmForm1!lstList2, "[LSList].[City]");
  4.  
Again, I understand your frustration. But please do not consider my help as any kind of obligation. I am helping you because I want to. I do not want to have a phone conversation, nor do I wish to exchange e-mails...As those to me are considered billable in my profession.

Sincerely,
J
woo hoo!! some progress! GREAT, i just got both textboxes the way I wanted them without them being duplicated. ok now, the code you gave me for the query is giving me a syntax error its missing an operator in here:

LSList.CITY where SalesLic952.CSPC = nz(forms!frmForm1!lstList1, "SalesLic952.CSPC") and [LSList].[City] = nz(forms!frmForm1!lstList2, "[LSList].[City]");

it highlights the word, "where"
May 10 '07 #40
JConsulting
603 Recognized Expert Contributor
woo hoo!! some progress! GREAT, i just got both textboxes the way I wanted them without them being duplicated. ok now, the code you gave me for the query is giving me a syntax error its missing an operator in here:

LSList.CITY where SalesLic952.CSPC = nz(forms!frmForm1!lstList1, "SalesLic952.CSPC") and [LSList].[City] = nz(forms!frmForm1!lstList2, "[LSList].[City]");

it highlights the word, "where"
Great! Revised..

Expand|Select|Wrap|Line Numbers
  1. SELECT SalesLic952.CSPC, LSList.NAME, LSList.CITY, LSList.ADDRESS, LSList.[POSTAL CODE], SalesLic952.QTY
  2. FROM LSList INNER JOIN SalesLic952 ON LSList.LIC_NO = SalesLic952.CUSTOMER
  3. WHERE SalesLic952.CSPC = nz(forms!frmForm1!lstList1, "SalesLic952.CSPC") and [LSList].[City] = nz(forms!frmForm1!lstList2, "[LSList].[City]")
  4. ORDER BY SalesLic952.CSPC, LSList.CITY;
  5.  
May 10 '07 #41
dbruzzese84
58 New Member
ok this one has no errors but an "Enter Parameters Value" box appears 3 times and asks me

LSList.Name (ok, cancel)

forms!frmform1!lstList1 (ok, cancel)

Forms!frmform1!lstList2 (ok, cancel)
May 10 '07 #42
JConsulting
603 Recognized Expert Contributor
ok this one has no errors but an "Enter Parameters Value" box appears 3 times and asks me

LSList.Name (ok, cancel)

forms!frmform1!lstList1 (ok, cancel)

Forms!frmform1!lstList2 (ok, cancel)
ok...so why do you think that is?

These aren't named correctly. chack your LSList table and see what the Name field is supposed to be.

Check your form and see what the names of those listboxes are.

Oh, and by the way, you need to actually select something from the listboxes. then hit the button.

J
May 10 '07 #43
dbruzzese84
58 New Member
ok...so why do you think that is?

These aren't named correctly. chack your LSList table and see what the Name field is supposed to be.

Check your form and see what the names of those listboxes are.

Oh, and by the way, you need to actually select something from the listboxes. then hit the button.

J
I added NAME to the query, it was giving the error because it could not find it. As for the textboxes, they are named correctly (List1 and List2)
May 10 '07 #44
JConsulting
603 Recognized Expert Contributor
I added NAME to the query, it was giving the error because it could not find it. As for the textboxes, they are named correctly (List1 and List2)
in a previous post you said this

Listbox w/CSPC is List0
Listbox w/City is List1

Also, you selected an item from your listboxes when you try to run the query correct?
May 10 '07 #45
dbruzzese84
58 New Member
correct, but i chaned the names to list1 and list2. i made sure that in the code you gave me, list1 and list2 are there. i am selecting an entry for list1(the product) and also an entry for list2. i press the command button, and thats what happens. could it be my form?
May 10 '07 #46
JConsulting
603 Recognized Expert Contributor
correct, but i chaned the names to list1 and list2. i made sure that in the code you gave me, list1 and list2 are there. i am selecting an entry for list1(the product) and also an entry for list2. i press the command button, and thats what happens. could it be my form?
you have some kind of click event on a button you're trying to run this from right?

paste this into that code. then push the button. You should have two message boxes pop up...one after the other. Tell me what they say

Expand|Select|Wrap|Line Numbers
  1. msgbox Forms!frmform1!lstList1
  2. msgbox Forms!frmform1!lstList2
  3.  
May 10 '07 #47
dbruzzese84
58 New Member
you have some kind of click event on a button you're trying to run this from right?

paste this into that code. then push the button. You should have two message boxes pop up...one after the other. Tell me what they say

Expand|Select|Wrap|Line Numbers
  1. msgbox Forms!frmform1!lstList1
  2. msgbox Forms!frmform1!lstList2
  3.  
it says that it cant find the form 'frmForm1' referred to in a macro or expression
May 10 '07 #48
JConsulting
603 Recognized Expert Contributor
it says that it cant find the form 'frmForm1' referred to in a macro or expression
what I just showed you was how to find out what's wrong. troubleshooting 101.

So what do you need to do?

If you open your form in design mode...look at the properties. What does the NAME property say?
May 10 '07 #49
dbruzzese84
58 New Member
it says that it cant find the form 'frmForm1' referred to in a macro or expression
i figured out the problem! instead of using frm in front of Form1 or lst in front of List1, i just use their names. even in the code for the query! it works!! wow, all that for one little thing :) thanks dude ;p u have no idea how happy i am. now that thats figured out, I can tell it to find other things as well.
May 10 '07 #50

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jeffrey Barish | last post by:
I have an application that produces two listboxes. I would like to be able to select one of the items in the first listbox and one of the items in the second listbox. However, when I make my...
1
by: Ryan | last post by:
Hello, I have a quick question (I hope). I have a form with a combo box and a multi-selection list box. The list box is based on a query. Users can select values from the cmbobox to add to...
6
by: Ralph2 | last post by:
Some time ago with a lot of help from this group I made a reasonably successful database to keep track of our shop drawings. However the searching mechanism is too complicated for the occasional...
8
by: Steve Jorgensen | last post by:
Mailing List management is a good example of a case where my conundrum arises. Say there is a m-m relationship between parties and groups - anyone can be a member of any combintation of groups. ...
4
by: bill yeager | last post by:
I have several template columns inside of a datagrid. Inside of these template columns are databound listboxes: <asp:TemplateColumn HeaderText="Crew Chiefs"> <ItemTemplate> <asp:listbox...
2
by: waterox | last post by:
Hi, I am trying to hack this mp3 player so that it displays 3 levels of hierarchy instead of 2. Check out the current player here http://www.yanwhite.com/staging/GetGoodMusic/music.htm ...
1
by: The.Daryl.Lu | last post by:
Hi, two parts to my problem if someone can help address either one or both: 1. I want to SELECT everything in the table if it matches the criteria when the query button is pressed (this is just...
2
by: Aussie Rules | last post by:
Hi, I have a access 2007 database with a cross tab query. Based on the selection critieria the cross tab may contain a different number columns in the result. For example if the query is...
3
JodiPhillips
by: JodiPhillips | last post by:
Hello everyone, there are many questions and answers relating to moving items between two listboxes here and on the net in general, however, none answer my specific problem. I have two listboxes...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.