all groups > vb.net controls > january 2005 >
You're in the

vb.net controls

group:

DropDown Combo Box Flaky


DropDown Combo Box Flaky Sam
1/26/2005 3:51:07 AM
vb.net controls:
I am using VB 6 Enterprise Edition. I am using an Access Database that was
created via Visual Data Manager.

I have 2 DropDown Combo Boxes. The 1st one called "cboCalcBuyListName"; the
2nd one is "cboCalcBuyListDate"

Scenerio: cboCalcBuyListName has names in it. cboCalcBuyListDate has dates
based off of the Name. So one Name can have one date, another name can have 3
dates, etc.
The "call" to these subroutines are in the "Got_Focus of the appropriate
combo box.

What's happening is this-- Let's say "cboCalcBuyListName" has: Name1 and
Name2. cboCalcBuyListDate for Name1 has one date listed (1/25/05) and Name2
has two dates listed (1/25/05, 1/26/05)

When I click on Name2, it will popluale cboCalcBuyListDate with 2 dates,
then when I go back (or forward) and click on Name1, the cboCalcBuyListDate
has the correct date in it BUT it also has the space below as if it had
another entry. When I close the cboCalcBuyListDate combo box, this space
which is part of the drop-down combo box seems to be still on the form.

Could this be a problem with a "dll" or "ocx" or my code?

Here is the code to populate each Combo Box:

Sub PopulateCalcBuyListName()
datBuyList.Refresh
cboCalcBuyListName.Clear
HoldCalcBuyListName = ""
On Error Resume Next
datBuyList.Recordset.MoveFirst
Do Until datBuyList.Recordset.EOF
If datBuyList.Recordset("blName") <> HoldCalcBuyListName Then
cboCalcBuyListName.AddItem datBuyList.Recordset("blName")
HoldCalcBuyListName = datBuyList.Recordset("blName")
End If
datBuyList.Recordset.MoveNext
Loop
End Sub
-----------------------------------------------------------
Sub PopulateCalcBuyListDate()
cboCalcBuyListDate.Clear
HoldCalcBuyListDate = ""
On Error Resume Next
datBuyList.Recordset.MoveFirst
Do Until datBuyList.Recordset.EOF
If datBuyList.Recordset("blName") = cboCalcBuyListName.Text And _
datBuyList.Recordset("blDate") <> HoldCalcBuyListDate Then
cboCalcBuyListDate.AddItem datBuyList.Recordset("blDate")
HoldCalcBuyListDate = datBuyList.Recordset("blDate")
End If
datBuyList.Recordset.MoveNext
Loop
End Sub
-------------------------------------------------------------
-------------------------------------------------------------
Thank You,
Re: DropDown Combo Box Flaky Ken Halter
1/31/2005 11:32:46 AM
[quoted text, click to view]

I can now see that the VB6 groups aren't the only ones that confuse
people... any group that contains "dotnet" in its name is a .Net group and
any answers you find here will most likely not do you any good in VB6.

As far as your code goes, I can see a lot of comparing this to that but none
that checks for an empty data field in the database. Seems like.... If This
<> "" And This = That Then AddItem is more like what you're looking for.

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..

AddThis Social Bookmark Button