nonfunctioning cbo box

  • Thread starter atlantis43 via AccessMonster.com
  • Start date
A

atlantis43 via AccessMonster.com

Hi;
Second time I'm asking this question, and hope someone can suggest a cure.
I'm running a form with a cbo box for data entry. I have 5 other BASICALLY
IDENTICAL cbo's on the form, all of which work fine.
My NotOnList event is as follows:

' Add a new policy type by typing a name in
' CoPolicy Type combo box.

Dim NewCoPolicyType As Integer, TruncateName As Integer, Title As String,
MsgDialog As Integer
Const MB_OK = 0
Const MB_YESNO = 4
Const MB_ICONQUESTIONMARK = 32
Const MB_ICONEXCLAMATION = 64
Const MB_DEFBUTTON1 = 0, IDYES = 6, IDNO = 7
' Display message box asking if user wants to add a
' new insurer.
Title = "Policy Type Not In List"
MsgDialog = MB_YESNO + MB_ICONQUESTIONMARK + MB_DEFBUTTON1
NewCoPolicyType = MsgBox("Do you want to add a new Policy Type?",
MsgDialog, Title)

If NewCoPolicyType = IDYES Then

' Open Add Policy form.
DoCmd.OpenForm FormName:="FPolicyTypeCo", DataMode:=acAdd, WindowMode:
=acDialog, openargs:=NewData
' Continue without displaying default error message.
Response = acDataErrAdded

End If
End Sub

When THIS PARTICULAR NotInList event fires, I am find that:
1)the cbo is not cleared of the newdata entry as the dialogue form opens (as
it does on all my other cbo's). Note, however, that the openargs ARE properly
carried to the dialogue form.
2)When the dialogue form is closed, my cbo is blank, and I get errmsg of
"item not in list".

Can anyone make any sense of why this is happening on only one of six cbos,
and any solution you can recommend.
TIA, Richard
 
B

Bob Quintal

Hi;
Second time I'm asking this question, and hope someone can
suggest a cure. I'm running a form with a cbo box for data
entry. I have 5 other BASICALLY IDENTICAL cbo's on the form,
all of which work fine. My NotOnList event is as follows:

' Add a new policy type by typing a name in
' CoPolicy Type combo box.

Dim NewCoPolicyType As Integer, TruncateName As Integer,
Title As String,
MsgDialog As Integer
Const MB_OK = 0
Const MB_YESNO = 4
Const MB_ICONQUESTIONMARK = 32
Const MB_ICONEXCLAMATION = 64
Const MB_DEFBUTTON1 = 0, IDYES = 6, IDNO = 7
' Display message box asking if user wants to add a
' new insurer.
Title = "Policy Type Not In List"
MsgDialog = MB_YESNO + MB_ICONQUESTIONMARK + MB_DEFBUTTON1
NewCoPolicyType = MsgBox("Do you want to add a new Policy
Type?",
MsgDialog, Title)

If NewCoPolicyType = IDYES Then

' Open Add Policy form.
DoCmd.OpenForm FormName:="FPolicyTypeCo",
DataMode:=acAdd, WindowMode:
=acDialog, openargs:=NewData
' Continue without displaying default error message.
Response = acDataErrAdded

End If
End Sub

When THIS PARTICULAR NotInList event fires, I am find that:
1)the cbo is not cleared of the newdata entry as the dialogue
form opens (as it does on all my other cbo's). Note, however,
that the openargs ARE properly carried to the dialogue form.
2)When the dialogue form is closed, my cbo is blank, and I get
errmsg of "item not in list".

Can anyone make any sense of why this is happening on only one
of six cbos, and any solution you can recommend.
TIA, Richard
Is there something special about this combo's row source that it
might be filtered with a bogus value, causing it to have no
records after the requery triggered by the NotInList Event?
 
R

richaluft

Is there something special about this combo's row source that it
might be filtered with a bogus value, causing it to have no
records after the requery triggered by the NotInList Event?

Rowsource for cbo that works PERFECTLY is:
SELECT DISTINCTROW Insurpolicy.[InsIndex#], Insurpolicy.[policy name]
FROM Insurpolicy WHERE (((Insurpolicy.[Insco#])=[Forms]!
[FINSURANCEINFO]![SelectInsco])) ORDER BY Insurpolicy.[policy name];

Rowsource for cbo that FAILS is:
SELECT DISTINCTROW Insurpolicy.[InsIndex#], Insurpolicy.[policy name]
FROM Insurpolicy WHERE (((Insurpolicy.[Insco#])=[Forms]!
[FINSURANCEINFO]![SelectCoInsco])) ORDER BY Insurpolicy.[policy name];


They both should be legitimate!
It seems that looking thru old questions in Access forums on this same
type of problem, there are people with similar problems to mine. What
is stranger, I've never been able to find any one who seems to have
achieved a solution!
 
B

Bob Quintal

(e-mail address removed) wrote in
in










Is there something special about this combo's row source that
it might be filtered with a bogus value, causing it to have
no records after the requery triggered by the NotInList
Event?

Rowsource for cbo that works PERFECTLY is:
SELECT DISTINCTROW Insurpolicy.[InsIndex#],
Insurpolicy.[policy name] FROM Insurpolicy WHERE
(((Insurpolicy.[Insco#])=[Forms]!
[FINSURANCEINFO]![SelectInsco])) ORDER BY Insurpolicy.[policy
name];

Rowsource for cbo that FAILS is:
SELECT DISTINCTROW Insurpolicy.[InsIndex#],
Insurpolicy.[policy name] FROM Insurpolicy WHERE
(((Insurpolicy.[Insco#])=[Forms]!
[FINSURANCEINFO]![SelectCoInsco])) ORDER BY
Insurpolicy.[policy name];


They both should be legitimate!
It seems that looking thru old questions in Access forums on
this same type of problem, there are people with similar
problems to mine. What is stranger, I've never been able to
find any one who seems to have achieved a solution!
The only difference I can see is the textbox on the form changes
from SelectInsco to SelectCoInsco. Correct?

Id do this for debugging.
Remove the whereClause and add the value of the field to the
Rowsource

SELECT DISTINCTROW Insurpolicy.[InsIndex#], Insurpolicy.[policy
name],[Forms]![FINSURANCEINFO]![SelectCoInsco] as test
FROM Insurpolicy ORDER BY Insurpolicy.[policy name];

Don't forget to increment the columns property.

Examine whether the form data is what it should be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top