473,395 Members | 1,706 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.

Dynamic values for Combo Box

I am new to Access coding , if anyone can help me it would be great


I have a patient table with fields like Firstname, lastname, DOB etc.
I have a combo box (cbName) on my form to search for a patient.
Whenever a user enters the first letter in the combo box , it should be populated with the patient names whose firstname or lastname starts with that particular letter.
And when the user enters second letter it should narrow the search and should display names according to the string entered in the combo box.

Waiting for your suggestions on this.

Thank you
Mar 25 '08 #1
4 1945
Somebody Give me answer please

I am new to Access coding , if anyone can help me it would be great


I have a patient table with fields like Firstname, lastname, DOB etc.
I have a combo box (cbName) on my form to search for a patient.
Whenever a user enters the first letter in the combo box , it should be populated with the patient names whose firstname or lastname starts with that particular letter.
And when the user enters second letter it should narrow the search and should display names according to the string entered in the combo box.

Waiting for your suggestions on this.

Thank you
Mar 26 '08 #2
Stewart Ross
2,545 Expert Mod 2GB
...I have a patient table with fields like Firstname, lastname, DOB etc.
I have a combo box (cbName) on my form to search for a patient.
Whenever a user enters the first letter in the combo box , it should be populated with the patient names whose firstname or lastname starts with that particular letter.
And when the user enters second letter it should narrow the search and should display names according to the string entered in the combo box.
...
Hi. What you describe is the default behaviour of Access combo boxes. If you use the Access wizard to create the combo the auto expand property does this for you.

Please note that your second post is not helpful, and will irritate other readers. You posted your original message yesterday, and today you nudge about receiving no response?

I believe you did not receive a reply as you have not done any research on your own for what is very simply a default behaviour of Access combos.

I would also comment that the way your question is phrased seems similar to a possible homework assignment for a School, college or university project. If this is the case please note that we cannot and will not do your homework for you.

Please read the site rules before posting in future.

MODERATOR
Mar 26 '08 #3
missinglinq
3,532 Expert 2GB
First off, you need to learn a little patience; this forum, like most of its kind, is manned by volunteers who donate their time for free!

"Whenever a user enters the first letter in the combo box , it should be populated with the patient names whose firstname or lastname starts with that particular letter."

This is never going to happen! The AutoExpand feature of Access comoboxes only works with the bound field of the combobox. If the bound field is firstname, it will work in the manner you describe for the first name. If the bound field is lastname, it will work in the manner you describe for the last name. But a single combobox will never do this for either firstname or lastname! It's one or the other!

What you can be do is to create a calculated field that ties the firstname and lastname together and then you this combined name as your bound field in your combobox.

If you have a query based on your table, go into it in Design View. If you don't, you need to go into Design View for Queries and create a query with all the data from your table. Now go to a blank field in the query grid and type this in:

CombinedName: [LastName] & " " & [FirstName]

Now go into Design View for your form and replace the table in the RecordSource with your query. Delete your old combobox and create a new one. This time, when the Wizard comes up and asks for the table or query to retrieve the data from, select your new query. Next choose CombinedName as the field for your combobox.

That should do it.

Welcome to TheScripts!

Linq ;0)>
Mar 26 '08 #4
FishVal
2,653 Expert 2GB
Just in addition to Linq's suggestion.

You may build a RowSource for the combo from union of queries - one concatenate first name with last name and other the same in reversed order.

Expand|Select|Wrap|Line Numbers
  1. SELECT tblNames.keyID, tblNames.txtFirstName & ' ' & tblNames.txtLastName AS txtFullName 
  2. FROM tblNames 
  3. UNION 
  4. SELECT tblNames.keyID, tblNames.txtLastName & ' ' & tblNames.txtFirstName AS txtFullName 
  5. FROM tblNames;
  6.  
Regards,
Fish
Mar 26 '08 #5

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

Similar topics

13
by: mr_burns | last post by:
hi, is it possible to change the contents of a combo box when the contents of another are changed. for example, if i had a combo box called garments containing shirts, trousers and hats, when...
2
by: Bob Shafer | last post by:
Is it possible to create dynamic enumerators in Visual Basic .Net? For example, an enumurator that provides a dropdown of available SQL servers?
3
by: vgrssrtrs | last post by:
<html> <head> <script language="JavaScript"> <!-- /* *** Multiple dynamic combo boxes *** by Mirko Elviro, 9 Mar 2005 *** ***Please do not remove this comment
9
by: Bob Alston | last post by:
In 2002, "GrayJay" posted the following code: I did this in a jazz record catalogue to find composers - On a form "frmComposers" Create a text box - txtFindComposer, and add the following sub...
4
by: Brian Shannon | last post by:
I have 3 combo boxes and two date text boxes on a .aspx page. The user can fill in any of the 5 controls or none to filter a datagrid. I was hoping someone could explain how to efficiently build...
6
by: Peter Herath | last post by:
I want to create a dynamic report using a crosstab query...... pls someone look into my attached example database and help me out to do the report generation.... example is like dis...: there...
3
by: jegadeep | last post by:
In a JSP page there are one combo box and one text feild..... Change in one combo box will have hit the database .... And get values from that , populate the corresponding values in the text...
4
by: PM ArunKumar | last post by:
i have two dropdown list in my form where the values in the list of second drop down changes based on the value i select in the first dropdown.(very similar to country and states list), here after...
2
by: Mtek | last post by:
Hi, We have a combo box on our page, which gets populated via a MySQL Query. What we want to do is to print the values on the page in a table that correspond the to selection from the combo...
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:
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...
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...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.