Combo Error "Text Not In List"

P

PHisaw

I have the following set up:

CustomerNameCombo that requeries ContactNameCombo after update.

ContactNameCombo with following Row Source:

SELECT tContactList.ContactID, tContactList.ContactName,
tContactList.CustomerID FROM tContactList WHERE
(((tContactList.CustomerID)=[forms]![fgeneralInfo]![CustomerNameCombo]));

and Not In List Event

Private Sub ContactNameCombo_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_ContactNameCombo_NotInList

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fContactList"

DoCmd.OpenForm stDocName, , , , acFormAdd, acDialog, NewData
Response = acDataErrAdded

Exit_ContactNameCombo_NotInList:
Exit Sub

Err_ContactNameCombo_NotInList:
MsgBox Err.Description
Resume Exit_ContactNameCombo_NotInList
End Sub

Form to allow user to enter name of new contact:

Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then

Me.ContactName = Me.OpenArgs
End If
End Sub

Everything was working fine - new entry form would open, allow new info to
be inserted, and when closed return to fgeninfo form with new contact info
already displayed. I decided to cascade the customer and contact combo boxes
to only have contact for specific customer display. Now, when I try to enter
a new contact, the form opens, I enter new entry, close it, go back to first
form and message is displayed "Text not in list".

Can someone please tell me what I'm missing?

Thanks in advance for any help.
Pam
 
S

Steve Sanford

Hi Pam,

Each Customer Name (CustomerNameCombo) can have many Contact Names
(ContactNameCombo).

It looks like the NotInList code is adding the Contact Name but it is not
adding the Customer Name.

This might work (this is untested!).... change the code for the form to
allow user to enter name of new contact to:

'------------------------------------
Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then
Me.ContactName = Me.OpenArgs
Me.CustomerID = [forms]![fgeneralInfo]![CustomerNameCombo]
End If
End Sub
'------------------------------------

Of course, the first field in the rowsource for the combo box
"CustomerNameCombo" must be "CustomerID".



I've used the recordset method to add new records in the "NotInList" event.
See

http://www.mvps.org/access/forms/frm0015.htm



HTH
 
P

PHisaw

Steve,

Thanks for the reply. I tried your suggestions and am still getting the
error message "Text isn't in list".

Do you have any other suggestions?
Pam

Steve Sanford said:
Hi Pam,

Each Customer Name (CustomerNameCombo) can have many Contact Names
(ContactNameCombo).

It looks like the NotInList code is adding the Contact Name but it is not
adding the Customer Name.

This might work (this is untested!).... change the code for the form to
allow user to enter name of new contact to:

'------------------------------------
Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then
Me.ContactName = Me.OpenArgs
Me.CustomerID = [forms]![fgeneralInfo]![CustomerNameCombo]
End If
End Sub
'------------------------------------

Of course, the first field in the rowsource for the combo box
"CustomerNameCombo" must be "CustomerID".



I've used the recordset method to add new records in the "NotInList" event.
See

http://www.mvps.org/access/forms/frm0015.htm



HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


PHisaw said:
I have the following set up:

CustomerNameCombo that requeries ContactNameCombo after update.

ContactNameCombo with following Row Source:

SELECT tContactList.ContactID, tContactList.ContactName,
tContactList.CustomerID FROM tContactList WHERE
(((tContactList.CustomerID)=[forms]![fgeneralInfo]![CustomerNameCombo]));

and Not In List Event

Private Sub ContactNameCombo_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_ContactNameCombo_NotInList

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fContactList"

DoCmd.OpenForm stDocName, , , , acFormAdd, acDialog, NewData
Response = acDataErrAdded

Exit_ContactNameCombo_NotInList:
Exit Sub

Err_ContactNameCombo_NotInList:
MsgBox Err.Description
Resume Exit_ContactNameCombo_NotInList
End Sub

Form to allow user to enter name of new contact:

Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then

Me.ContactName = Me.OpenArgs
End If
End Sub

Everything was working fine - new entry form would open, allow new info to
be inserted, and when closed return to fgeninfo form with new contact info
already displayed. I decided to cascade the customer and contact combo boxes
to only have contact for specific customer display. Now, when I try to enter
a new contact, the form opens, I enter new entry, close it, go back to first
form and message is displayed "Text not in list".

Can someone please tell me what I'm missing?

Thanks in advance for any help.
Pam
 
S

Steve Sanford

Pam

When the form "fContactList" opens, do you see the new Contact Name and
Customer Name ID?

Oops, had a thought.... did you add the "CustomerID" field to the form
recordsource?


Set a breakpoint on this line of the code:

Private Sub ContactNameCombo_NotInList(NewData As String, Response As Integer)

Single step thru the code to see what happens during code execution. Check
the variable values to see if the correct values are being entered.


--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


PHisaw said:
Steve,

Thanks for the reply. I tried your suggestions and am still getting the
error message "Text isn't in list".

Do you have any other suggestions?
Pam

Steve Sanford said:
Hi Pam,

Each Customer Name (CustomerNameCombo) can have many Contact Names
(ContactNameCombo).

It looks like the NotInList code is adding the Contact Name but it is not
adding the Customer Name.

This might work (this is untested!).... change the code for the form to
allow user to enter name of new contact to:

'------------------------------------
Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then
Me.ContactName = Me.OpenArgs
Me.CustomerID = [forms]![fgeneralInfo]![CustomerNameCombo]
End If
End Sub
'------------------------------------

Of course, the first field in the rowsource for the combo box
"CustomerNameCombo" must be "CustomerID".



I've used the recordset method to add new records in the "NotInList" event.
See

http://www.mvps.org/access/forms/frm0015.htm



HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


PHisaw said:
I have the following set up:

CustomerNameCombo that requeries ContactNameCombo after update.

ContactNameCombo with following Row Source:

SELECT tContactList.ContactID, tContactList.ContactName,
tContactList.CustomerID FROM tContactList WHERE
(((tContactList.CustomerID)=[forms]![fgeneralInfo]![CustomerNameCombo]));

and Not In List Event

Private Sub ContactNameCombo_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_ContactNameCombo_NotInList

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fContactList"

DoCmd.OpenForm stDocName, , , , acFormAdd, acDialog, NewData
Response = acDataErrAdded

Exit_ContactNameCombo_NotInList:
Exit Sub

Err_ContactNameCombo_NotInList:
MsgBox Err.Description
Resume Exit_ContactNameCombo_NotInList
End Sub

Form to allow user to enter name of new contact:

Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then

Me.ContactName = Me.OpenArgs
End If
End Sub

Everything was working fine - new entry form would open, allow new info to
be inserted, and when closed return to fgeninfo form with new contact info
already displayed. I decided to cascade the customer and contact combo boxes
to only have contact for specific customer display. Now, when I try to enter
a new contact, the form opens, I enter new entry, close it, go back to first
form and message is displayed "Text not in list".

Can someone please tell me what I'm missing?

Thanks in advance for any help.
Pam
 
P

PHisaw

Steve,

I added a hidden text box for the CustomerID and it worked.
Thanks for your help.
Pam

Steve Sanford said:
Pam

When the form "fContactList" opens, do you see the new Contact Name and
Customer Name ID?

Oops, had a thought.... did you add the "CustomerID" field to the form
recordsource?


Set a breakpoint on this line of the code:

Private Sub ContactNameCombo_NotInList(NewData As String, Response As Integer)

Single step thru the code to see what happens during code execution. Check
the variable values to see if the correct values are being entered.


--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


PHisaw said:
Steve,

Thanks for the reply. I tried your suggestions and am still getting the
error message "Text isn't in list".

Do you have any other suggestions?
Pam

Steve Sanford said:
Hi Pam,

Each Customer Name (CustomerNameCombo) can have many Contact Names
(ContactNameCombo).

It looks like the NotInList code is adding the Contact Name but it is not
adding the Customer Name.

This might work (this is untested!).... change the code for the form to
allow user to enter name of new contact to:

'------------------------------------
Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then
Me.ContactName = Me.OpenArgs
Me.CustomerID = [forms]![fgeneralInfo]![CustomerNameCombo]
End If
End Sub
'------------------------------------

Of course, the first field in the rowsource for the combo box
"CustomerNameCombo" must be "CustomerID".



I've used the recordset method to add new records in the "NotInList" event.
See

http://www.mvps.org/access/forms/frm0015.htm



HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:

I have the following set up:

CustomerNameCombo that requeries ContactNameCombo after update.

ContactNameCombo with following Row Source:

SELECT tContactList.ContactID, tContactList.ContactName,
tContactList.CustomerID FROM tContactList WHERE
(((tContactList.CustomerID)=[forms]![fgeneralInfo]![CustomerNameCombo]));

and Not In List Event

Private Sub ContactNameCombo_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_ContactNameCombo_NotInList

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fContactList"

DoCmd.OpenForm stDocName, , , , acFormAdd, acDialog, NewData
Response = acDataErrAdded

Exit_ContactNameCombo_NotInList:
Exit Sub

Err_ContactNameCombo_NotInList:
MsgBox Err.Description
Resume Exit_ContactNameCombo_NotInList
End Sub

Form to allow user to enter name of new contact:

Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then

Me.ContactName = Me.OpenArgs
End If
End Sub

Everything was working fine - new entry form would open, allow new info to
be inserted, and when closed return to fgeninfo form with new contact info
already displayed. I decided to cascade the customer and contact combo boxes
to only have contact for specific customer display. Now, when I try to enter
a new contact, the form opens, I enter new entry, close it, go back to first
form and message is displayed "Text not in list".

Can someone please tell me what I'm missing?

Thanks in advance for any help.
Pam
 
S

Steve Sanford

Wonderful :)

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


PHisaw said:
Steve,

I added a hidden text box for the CustomerID and it worked.
Thanks for your help.
Pam

Steve Sanford said:
Pam

When the form "fContactList" opens, do you see the new Contact Name and
Customer Name ID?

Oops, had a thought.... did you add the "CustomerID" field to the form
recordsource?


Set a breakpoint on this line of the code:

Private Sub ContactNameCombo_NotInList(NewData As String, Response As Integer)

Single step thru the code to see what happens during code execution. Check
the variable values to see if the correct values are being entered.


--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


PHisaw said:
Steve,

Thanks for the reply. I tried your suggestions and am still getting the
error message "Text isn't in list".

Do you have any other suggestions?
Pam

:

Hi Pam,

Each Customer Name (CustomerNameCombo) can have many Contact Names
(ContactNameCombo).

It looks like the NotInList code is adding the Contact Name but it is not
adding the Customer Name.

This might work (this is untested!).... change the code for the form to
allow user to enter name of new contact to:

'------------------------------------
Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then
Me.ContactName = Me.OpenArgs
Me.CustomerID = [forms]![fgeneralInfo]![CustomerNameCombo]
End If
End Sub
'------------------------------------

Of course, the first field in the rowsource for the combo box
"CustomerNameCombo" must be "CustomerID".



I've used the recordset method to add new records in the "NotInList" event.
See

http://www.mvps.org/access/forms/frm0015.htm



HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:

I have the following set up:

CustomerNameCombo that requeries ContactNameCombo after update.

ContactNameCombo with following Row Source:

SELECT tContactList.ContactID, tContactList.ContactName,
tContactList.CustomerID FROM tContactList WHERE
(((tContactList.CustomerID)=[forms]![fgeneralInfo]![CustomerNameCombo]));

and Not In List Event

Private Sub ContactNameCombo_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_ContactNameCombo_NotInList

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fContactList"

DoCmd.OpenForm stDocName, , , , acFormAdd, acDialog, NewData
Response = acDataErrAdded

Exit_ContactNameCombo_NotInList:
Exit Sub

Err_ContactNameCombo_NotInList:
MsgBox Err.Description
Resume Exit_ContactNameCombo_NotInList
End Sub

Form to allow user to enter name of new contact:

Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then

Me.ContactName = Me.OpenArgs
End If
End Sub

Everything was working fine - new entry form would open, allow new info to
be inserted, and when closed return to fgeninfo form with new contact info
already displayed. I decided to cascade the customer and contact combo boxes
to only have contact for specific customer display. Now, when I try to enter
a new contact, the form opens, I enter new entry, close it, go back to first
form and message is displayed "Text not in list".

Can someone please tell me what I'm missing?

Thanks in advance for any help.
Pam
 

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