Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo box afterupdate issue

Status
Not open for further replies.

Lhuffst

Programmer
Jun 23, 2003
503
US
I have a combo box that displays all my contracts fine. There are a couple of times when you select a value that a different record actually shows up and I dont' know why. It is an unbound combobox with the following record source
Code:
SELECT tblContracts.FldContractNum, tblContracts.fldSubdivisionName, tblContracts.fldContractId FROM tblContracts;

The first time in, the list of contract show properly and in most cases the combo box works properly. However, if I select 92-9305, it ends up displaying 03-3641. The only thing that is duplicated is the fldsubdivisionname but I am bound to fldcontractid as the boundcolumn. I don't know what to do to fix this issue and hoping for some help. Thanks lhuffst
 
Are there duplicate fldContractIDs? What do you see with this query:
Code:
SELECT fldContractID, Count(*) as NumOF
FROM tblContracts
Having Count(*) >1;
What are the other significant properties of the combo box?

Duane
Hook'D on Access
MS Access MVP
 
I looked at the query and made sure that duplicates were not there.
I did debug statements to make sure that the correct values went with the correct column.

Other than that, I don't know what to check. Originally on afterupdate, I requery a different combo box and thought that might be causing the problem so I commented out the afterupdate and still get the same results.
 
Sorry thought I had answered your question.
CboContracts combobox
Code:
Rowsource type = table/query
Rowsource = SELECT DISTINCT tblContracts.FldContractNum, tblContracts.fldSubdivisionName, tblContracts.fldContractId FROM tblContracts; 
Bound Column = 2
After Update Event:
 txtid = cboContracts.Column(2)
   Debug.Print cboContracts.Column(0)
    Debug.Print cboContracts.Column(1)
    Debug.Print cboContracts.Column(2)

    Me.cboBoxNumbers.Requery

Since clicking on the 92-9305 contract in the drop down box displays the 03-3641 contract, I made a query to see the differences.

[blue]
fldcontractid fldcontractnum fldsubdivisionname
397 03-3641 tantallon on the potomac
9182 92-9305 tantallon on the potomac
[/blue]
I am not sure why it is picking up the first record in the database because the mainid (fldcontractid) is unique as is the contractnum. How do I avoid this?
Thanks
 
ok thanks. I thought you counted columns as 0,1,2. I'll make that change and retest. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top