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

How to pass 2 parameters from a list box into a query?

When I choose an item with 2 columns in a list box, and press a button, I hope to pass this 2 columns as parameters into a query?

e.g.
WHERE (((Career_Profile.Job_Type)=Forms!Form_Development!Control_Job_Type) And ((Career_Profile.Job_Level)=Forms!Form_Development!Control_Job_Level)

The problem is that query only got the first column -"Control_Job_Type" and never got the second one - "Control_Job_Level".

What do you think?
Attached Images
File Type: jpg Form_Development_2.jpg (15.1 KB, 400 views)
Sep 8 '09 #1

✓ answered by NeoPa

Bound controls are certainly important. It is usual to bind a control to the underlying dataset in such cases. Only one column can be bound.

However, I doubt (not certain) that SQL can access the Column function reference required to access both columns. If it turns out that it cannot, then I suggest setting another control to reflect the value of the other column using an AfterUpdate event procedure. It would not generally be necessary to bind this other control (TextBox or Label would probably be the easiest to use).

5 3911
ChipR
1,287 Expert 1GB
You need to reference the name of the combo box, then the appropriate column. The index starts at zero. For example:
Forms!myForm!cboDropDown.Column(0)
Forms!myForm!cboDropDown.Column(1)
Sep 8 '09 #2
ajalwaysus
266 Expert 100+
I concur with ChipR. Even though you have multiple columns, when creating a combo box, you need to bound the combo box to a single value that you can quickly reference. ChipR's solution helps you access the combo box by each column.

Here s a quick look at bounding columns, FYI...
http://office.microsoft.com/en-us/ac...877861033.aspx

-AJ
Sep 8 '09 #3
NeoPa
32,556 Expert Mod 16PB
Bound controls are certainly important. It is usual to bind a control to the underlying dataset in such cases. Only one column can be bound.

However, I doubt (not certain) that SQL can access the Column function reference required to access both columns. If it turns out that it cannot, then I suggest setting another control to reflect the value of the other column using an AfterUpdate event procedure. It would not generally be necessary to bind this other control (TextBox or Label would probably be the easiest to use).
Sep 8 '09 #4
@NeoPa
You're so right. If I access the second column using Forms!myForm!cboDropDown.Column(1), it would only return the first row's second column, it doesn't reflect the value I choose from listbox.

And I use "afterupdate" to set another control to reflect the second column I "select", it works good!

Thank you guys!
Sep 9 '09 #5
NeoPa
32,556 Expert Mod 16PB
I'm pleased to have helped.

Well done for taking that on and getting the solution to work for you btw.
Sep 9 '09 #6

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

Similar topics

6
by: HH | last post by:
I'm learning to design web applications with php, mysql, and apache from a book. I copied a sample application called guestbook 2000 that came with the CD in the book to my htdocs folder, but...
5
by: Belinda | last post by:
Hello All I have the following test.asp page which needs one parameter querystr but my querystr is a very long string value. When I send a long value the query string is getting truncated after...
2
by: Jeff Thur | last post by:
I am running a SQL Stored Procedure that will give the user a count of how many records are in the database as per certain criteria. I'm using the Execute Scalar Method. I have no problem passing...
11
by: Andrew Thompson | last post by:
I have written a few scripts to parse the URL arguments and either list them or allow access to the value of any parameter by name. <http://www.physci.org/test/003url/index.html>...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
3
by: Zlatko Matić | last post by:
Hello. I'm wondernig what is happennig whith saved pass-through queries nested in regular JET query if regular JET query just filtrates result by start/end date...Does pass-through query first...
0
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
1
by: Mayhem05 | last post by:
I have an Access 2003 database that I need to write some VBA code for to populate a table. The table is based on a query I have built in Access queries. Right now I have 2 parameters that are...
2
by: gumby | last post by:
I would like to call this stored procedure, but I am unable to pass parameters to the @Start and @End. Is thier a way to pass parameters to a pass through query from MS Access? SELECT ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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.