473,770 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combo box selection gives wrong record - strange

BigToe
11 New Member
Hello, if anyone out there can shed light on the fact that when a last name is selected in a combo box, and that name is shared by more than one person, why access is displaying the first record in the list of like names. (i.e. when choosing 'zach smith' , 'andy smith's record will be shown. I assume that it's sorting by first names when last names are the same that doesn't explain why it always shows the record of the first person amoung a group with the same last name when another person is selected within that group. any ideas?
Sep 25 '07 #1
13 8455
Scott Price
1,384 Recognized Expert Top Contributor
Hello, if anyone out there can shed light on the fact that when a last name is selected in a combo box, and that name is shared by more than one person, why access is displaying the first record in the list of like names. (i.e. when choosing 'zach smith' , 'andy smith's record will be shown. I assume that it's sorting by first names when last names are the same that doesn't explain why it always shows the record of the first person amoung a group with the same last name when another person is selected within that group. any ideas?
What is the RowSource and table structure for your combobox?

Regards,
Scott
Sep 25 '07 #2
BigToe
11 New Member
What is the RowSource and table structure for your combobox?

Regards,
Scott

Scott,
the rowsource is a querry. the row source type is 'Table/Querry'. the sql for that querry looks like this:

SELECT [Clients].[Last Name], [Clients].[First Name]
FROM Clients
WHERE ((([Clients].[Service Coordinator])=[Forms]![recall client stats]![cboSC])) Or ((([Clients].[Waitlist Region])=[forms]![recall client stats]![cbowaitlist]));

I hope that answers your question.
thanks
tony
Sep 26 '07 #3
Scott Price
1,384 Recognized Expert Top Contributor
Scott,
the rowsource is a querry. the row source type is 'Table/Querry'. the sql for that querry looks like this:

SELECT [Clients].[Last Name], [Clients].[First Name]
FROM Clients
WHERE ((([Clients].[Service Coordinator])=[Forms]![recall client stats]![cboSC])) Or ((([Clients].[Waitlist Region])=[forms]![recall client stats]![cbowaitlist]));

I hope that answers your question.
thanks
tony
Hi Tony,

The problem is probably showing up because you aren't using a unique field as a 'control field' in your query. I'm assuming that in your combo box the bound column is the default of 1. This means that the value returned by the combo box choice will be the value from column 1, which in your case is the last name, and being as the last name field contains duplicates, the first of those is being used.

Add your ClientID field into the query as the first item in your select statement, and make sure the bound column is set to 1.

Regards,
Scott
Sep 26 '07 #4
BigToe
11 New Member
Hi Tony,

The problem is probably showing up because you aren't using a unique field as a 'control field' in your query. I'm assuming that in your combo box the bound column is the default of 1. This means that the value returned by the combo box choice will be the value from column 1, which in your case is the last name, and being as the last name field contains duplicates, the first of those is being used.

Add your ClientID field into the query as the first item in your select statement, and make sure the bound column is set to 1.

Regards,
Scott

thanks for your patience Scott but this is still not working. I placed the ClientID field first in the sql statement, set the bound column to 1 (it was already) and a). after choosing a name in the combo box the hourglass just hung for about 10 sec. and nothing happened (i.e the record for that client did not show) and b). the ClientID number now appears in the combo box. when i deselect 'show' in the querry builder it deletes the ClientID field in the sql statement all together! is that normal? here's my new sql statement:

SELECT [Clients].[ClientID], [Clients].[Last Name], [Clients].[First Name]
FROM Clients;
Tony
Sep 26 '07 #5
missinglinq
3,532 Recognized Expert Specialist
I solved this problem by adding a calculated field in my query, then basing the combobox on the calculated field. In a new field in query design, under the field name enter something like

WholeClientName : [LastName] & " " & [FirstName]

then run the Combobox Wizard and select WholeClientName as the field to pull on.

Welcome to TheScripts!

Linq ;0)>
Sep 26 '07 #6
Scott Price
1,384 Recognized Expert Top Contributor
thanks for your patience Scott but this is still not working. I placed the ClientID field first in the sql statement, set the bound column to 1 (it was already) and a). after choosing a name in the combo box the hourglass just hung for about 10 sec. and nothing happened (i.e the record for that client did not show) and b). the ClientID number now appears in the combo box. when i deselect 'show' in the querry builder it deletes the ClientID field in the sql statement all together! is that normal? here's my new sql statement:

SELECT [Clients].[ClientID], [Clients].[Last Name], [Clients].[First Name]
FROM Clients;
Tony
Take a good look at Linq's suggestion! Also, whenever you have multiple columns in a combo box, and the first column is an ID number field, make sure that the column widths are set to 0", 1.5" (or whatever width needed to display the data), etc...

As for the problem of the db 'hanging' for 10 sec, what field is the combo box bound to? Now that the bound column is an ID field, the bound field needs to be an ID field also!

At the risk of sounding patronizing, please also make sure that you have compiled, saved, backed up, and compacted/repaired your database (in that order). When developing (I'm sure you know this, but never hurts to say it again...) this process should be done at least once a day, and the compile/save every time you make a change in your code window.

Regards,
Scott
Sep 27 '07 #7
BigToe
11 New Member
Take a good look at Linq's suggestion! Also, whenever you have multiple columns in a combo box, and the first column is an ID number field, make sure that the column widths are set to 0", 1.5" (or whatever width needed to display the data), etc...

As for the problem of the db 'hanging' for 10 sec, what field is the combo box bound to? Now that the bound column is an ID field, the bound field needs to be an ID field also!

At the risk of sounding patronizing, please also make sure that you have compiled, saved, backed up, and compacted/repaired your database (in that order). When developing (I'm sure you know this, but never hurts to say it again...) this process should be done at least once a day, and the compile/save every time you make a change in your code window.

Regards,
Scott
Good reminders Scott - thank you. I figured out the spacing of the columns and place the ClientID column first (already set to autonumbers). I also have set the bound column to the first column (clientID). because I have never created a calculated field before I will give that a go tomorrow and let you all know the results.
cheers,
Tony
Sep 27 '07 #8
BigToe
11 New Member
Gentlemen, this seems like an exercise in futility. I hope you have the patience to endure another question. I successfully created a calculated field (which I think are extremely cool btw) but my vba code for that combo box doesn't seem to like the new format, i.e. records to not change when a name is selected from the combo box. Unless i'm missing something obvious, I can only assume that there's something inherently wrong with my form. I've removed the calculated field and there is no change. the querry that I once had working no longer works. I have saved and compacted/repaired with no luck. the vba code for that combo box is still the same (Clientstemp is the subform):

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboClients_AfterUpdate()
  2.     'Moves to client Name text box and
  3.     'finds the record of whatever name is selected in the combo box
  4.  
  5.     DoCmd.ShowAllRecords
  6.     Me!Clientstemp.SetFocus
  7.     DoCmd.FindRecord Me!cboClients
  8.  
  9.     'just moves the highlighted cursor away from the Last Name after selection is made
  10.     DoCmd.GoToControl "middle name"
  11.  
  12.     'Set value of combo box equal to an empty string
  13.     Me!cboClients.Value = ""
  14.  
  15. End Sub
The form i have created has 3 combo boxes in the header and a subform in the body (below the header). This subform was created with the forms wizard and saved as a form; then imported into this form as a subform.The first and last name text boxes are in the subform with all the other client information broken up under tabs (or pages). This may be extraneous information but if anyone can see a connection to the way this form is set up to the lack of control I have with calling up a record please reveal it to me! I'd be willing to start from scratch if it meant a smoother process for building this database.
thanks again,
Tony
Oct 3 '07 #9
Scott Price
1,384 Recognized Expert Top Contributor
Hi, Tony!

You shouldn't need to start from scratch (at least not yet :-)

When referring to subforms the correct syntax is Forms![MainFormName]![SubFormName].Form![ControlName].

I see in your code you are trying to refer to the subform like this: Me![Subformname]![ComboboxName].

Change this over and see what happens.

Regards,
Scott
Oct 4 '07 #10

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

Similar topics

1
1669
by: Alex | last post by:
Acc97.. I have a database which records down-time on 8 machines, the selection of reasons comes from a combo box. I have tried to be clever! and limit the options relative to each machine within the SQL and selecting the most reoccurring reasons on the top of the list. Sounds good.. Problem...
1
1757
by: Mark Lees | last post by:
I would like to use a combobox that looks up values. For example, I want my users to be able to select a client's last name from a combobox and then by selecting the client's last name all of the information @ the patient is populated in the form.
3
2294
by: J | last post by:
I've moved the database tables from the .mdb file to Sql Svr and now I have an *intermittent* problem. When I select a record from a combo box, it will intermittently pull up the wrong record. The code that does the search is below. I have a column named 'ProsId' that is a unique number (identity column). The error -- when it happens -- seems to only happen on higher ProsId numbers. At first it appeared to me as some sort of data...
7
4339
by: ShyGuy | last post by:
I have a form with a combo box for last name. It shows the record with whatever name I select in the combo box. I am trying to get the same results with code when I open the form by using a value from another form. I tried Me.RecordsetClone.FindFirst " = '" & Forms!SelectName! & "'" Me.Bookmark = Me.RecordsetClone.Bookmark
0
1555
by: paulquinlan100 | last post by:
Hi I have a combo-box which is filled with values from a query with the current record ID as a parameter. This all works fine, except the combobox always starts with a blank record so at first glance would appear empty when in actual fact its filled with a number of values. I've tried using the following but i get the error "Invalid use of property" on the listindex line.
1
1874
by: kevvan | last post by:
I have a form that presents a user with a dropdown populated with a user name. The drop down control is bound to two things in a user table, the USERNAME and a related USERID. The drop down control bound to the second column which is the USERID. When they make a selection from the dropdown, it populates a separate text box control with the USER ID value. The problem is this... When duplicate entries exist int he USERNAME field, no...
3
1629
by: zufie | last post by:
How can I get the Value that I select using my Combo Box to be UNIQUE (to save to ONE record)to the respective Record that I am viewing on my Form? At present, when I select a Value from the Combo Box this Value displays on EACH of the 7441 records that I can view using my Form. I know its some small detail on my Combo Box properties that I am overlooking?
3
1515
by: dblack64 | last post by:
I am working in Access 2007. I have a form named Master Terms List that contains 4 bound text boxes and 7 cascading combo boxes. The bound text boxes have data sources from a table named Termslist. The record source for the 7 cascading combo boxes is also the table Termslist. The names of the fields on form Master Terms List and the type of controls they are follows: Termslistmonth - text box DateReceived - text box Coordinator - combo box...
4
2383
by: dekk | last post by:
I am trying to populate a text field from the combo selection. I have the following update event in the combo box Private Sub cboContract_AfterUpdate() Me!txtDesc = Me!cboContract.Column(1) Me!txtPrinc = Me!cboContract.Column(2) Me.Refresh Me.tbl_TimeData.Form.cboAct.Requery End Sub
0
9617
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10037
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8931
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4007
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 we have to send another system
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.