ComboBoox stays blank

  • Thread starter Thread starter Alan Z. Scharf
  • Start date Start date
A

Alan Z. Scharf

1. A combo box stays blank after setting its value to a DLookup. (Code at
end of message.)

2. NOTE: The lookup works and returns the proper value, AND even the value
of the combo box Me!cboFundNames shows the proper value in code upon
stopping running code at that point!

3. However, the combo box on the form remains blank!

4. The same combo box on the form works with other DLookups used in the
app. Either they should all work or all fail.

5. I can't figure this one out. Any suggestions would be greatly
appreciated.

Thanks.

Alan

Combo Box Code:
-------------------------
Me!cboFundNames = DLookup("[ParCode]", "qryFundNamesMissing",
"[Holding] = '" & DMin("[FundName]", "qryDocumentsMissing",
"[RequiredHoldCode] = '" & Me!cboHoldingNames & "'") & "'")
Me!cboFundNames.RowSource = ("SELECT Holding, HoldCode FROM
qryFundNamesMissing")



___________________________
Alan Z. Scharf
GrapeVine Systems
New York City
 
---------- "Alan Z. Scharf said:
1. A combo box stays blank after setting its value to a DLookup. (Code at
end of message.)

2. NOTE: The lookup works and returns the proper value, AND even the value
of the combo box Me!cboFundNames shows the proper value in code upon
stopping running code at that point!

3. However, the combo box on the form remains blank!

4. The same combo box on the form works with other DLookups used in the
app. Either they should all work or all fail.
Combo Box Code:
-------------------------
Me!cboFundNames = DLookup("[ParCode]", "qryFundNamesMissing",
"[Holding] = '" & DMin("[FundName]", "qryDocumentsMissing",
"[RequiredHoldCode] = '" & Me!cboHoldingNames & "'") & "'")
Me!cboFundNames.RowSource = ("SELECT Holding, HoldCode FROM
qryFundNamesMissing")

Alan,

apart from teh question, why do you need all those DLookups, there are
couple of problems with the code. Please note, if the LimitToList
property is set to Yes, each assigned value must fit an entry from the
combo list, otherwise it won't be displayed (or even throw a message).

1. You first assign a value to the combo, the value of afield called
ParCode. What is the RowSourfce of the combo at this moment? Does the
ParCode value fit in?

2. Then you assign as a RowSource a query returning the fields Holding
and HoldCode. How should the combo now display ParCode? Is its value
the same as HoldCode, is its value in the list returned by the query?

And BTW, the brackets around the SELECT query are not needed. This may
also be the problem, actually this should throw an error.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 
Emilia,

1. Thanks very much for looking so closoely at the code.

2. Thr problem was in the rowsource, as you indicated: I should have been
using ParCode, not HoldCode. I was staring at this for two days and didn't
see it. Probably working too long!
2. Then you assign as a RowSource a query returning the fields Holding
and HoldCode. How should the combo now display ParCode? Is its value
the same as HoldCode, is its value in the list returned by the query?

Thanks again.

Regards,

Alan


Emilia Maxim said:
---------- "Alan Z. Scharf said:
1. A combo box stays blank after setting its value to a DLookup. (Code at
end of message.)

2. NOTE: The lookup works and returns the proper value, AND even the value
of the combo box Me!cboFundNames shows the proper value in code upon
stopping running code at that point!

3. However, the combo box on the form remains blank!

4. The same combo box on the form works with other DLookups used in the
app. Either they should all work or all fail.
Combo Box Code:
-------------------------
Me!cboFundNames = DLookup("[ParCode]", "qryFundNamesMissing",
"[Holding] = '" & DMin("[FundName]", "qryDocumentsMissing",
"[RequiredHoldCode] = '" & Me!cboHoldingNames & "'") & "'")
Me!cboFundNames.RowSource = ("SELECT Holding, HoldCode FROM
qryFundNamesMissing")

Alan,

apart from teh question, why do you need all those DLookups, there are
couple of problems with the code. Please note, if the LimitToList
property is set to Yes, each assigned value must fit an entry from the
combo list, otherwise it won't be displayed (or even throw a message).

1. You first assign a value to the combo, the value of afield called
ParCode. What is the RowSourfce of the combo at this moment? Does the
ParCode value fit in?

2. Then you assign as a RowSource a query returning the fields Holding
and HoldCode. How should the combo now display ParCode? Is its value
the same as HoldCode, is its value in the list returned by the query?

And BTW, the brackets around the SELECT query are not needed. This may
also be the problem, actually this should throw an error.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 
Back
Top