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

using query results to populate a list or form

Hi,

I need some help. I have created a form where there are 3 combo boxes
and a text box to search through records. Based on what the user fills
in, you then it a "go" button to run the query and obtain the search
results. This is all working correctly except for the fact that it
opens up the results in datasheet view.

What i want to happen is, when the user hits "go" to run the query, the
results are used to populate a list box on the same form.

Can anyone help me?

Nov 13 '05 #1
5 11542
Set the listbox's row source property to the query and put the following
code in the "go" button's click event:
Me!NameOfListBox.Requery

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
<ch*******@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hi,

I need some help. I have created a form where there are 3 combo boxes
and a text box to search through records. Based on what the user fills
in, you then it a "go" button to run the query and obtain the search
results. This is all working correctly except for the fact that it
opens up the results in datasheet view.

What i want to happen is, when the user hits "go" to run the query, the
results are used to populate a list box on the same form.

Can anyone help me?

Nov 13 '05 #2
Thanks for your quick response.

I have already made the rowsource porperty of the list box to the
query. I think the problem may lie in how i am getting my query to run.

At the moment, when the user hits "go" the following code runs:

DoCmd.OpenQuery "qrySearch", acViewNormal

lstResults.Requery

Is there another way to get the query to run?

Nov 13 '05 #3
ch*******@hotmail.com wrote in
news:11**********************@z14g2000cwz.googlegr oups.com:
Thanks for your quick response.

I have already made the rowsource porperty of the list box to
the query. I think the problem may lie in how i am getting my
query to run.

At the moment, when the user hits "go" the following code
runs:

DoCmd.OpenQuery "qrySearch", acViewNormal

lstResults.Requery

Is there another way to get the query to run?

Reread PC Datasheet's response. he told you exactly the command to
use.
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #4
Delete the DoCmd line. When you requery the query will automatically run and
fill the listbox with the results.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
<ch*******@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Thanks for your quick response.

I have already made the rowsource porperty of the list box to the
query. I think the problem may lie in how i am getting my query to run.

At the moment, when the user hits "go" the following code runs:

DoCmd.OpenQuery "qrySearch", acViewNormal

lstResults.Requery

Is there another way to get the query to run?

Nov 13 '05 #5
Thanks you were right the first time. It is not that i didn't try what
you wrote. It is that i did and it didn't work. But, i have discovered
the problem.

It was in the code for my reset button. I had to make the rowsource in
that code the query also. Where as before it was referencing the table.
As a result, after i hit reset it would not search.

Thank you so much for your help PC Datasheet. You have helped me
complete my database!!!!!!!!

Nov 13 '05 #6

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

Similar topics

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...
1
by: tina.boroff | last post by:
I have 3 boxes that essentially use the same code for not in List events (Thank you to David for all of your help on that one). The code opens another form if the user wants to enter data that is...
0
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
9
by: Jimbo | last post by:
Hello, I have a user request to build a form in an Access database where the user can check off specific fields to pull in a query. For example, let's say I have 10 fields in a table. The user...
2
by: roz | last post by:
Hello, I'm fairly new to VB programming and I've been going round the bend with this problem, so any nudges or shoves in the right direction would be greatly appreciated. I have a template...
4
by: Jimmy | last post by:
I have a form with a command button on it that is supposed to open up a report and use a query to populate it. DoCmd.OpenReport "rptMailingList", acViewPreview, "qryMailingListChristmas" ...
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...
13
by: Robertf987 | last post by:
Hi, Yet another thing I need help with I'm affraid. I'll first explain what I want, then I'll try to explain what I have. I'm using Microsoft Access 2000. What I want is to be able to do a...
1
by: Arli | last post by:
I have the following linked tables: tblMainPL is my main table that I need to pull the information in from. It has the following fields: Autonumber1 -PK set as autonumber Date - short date...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
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...

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.