Not in List Issue (1 Viewer)

andy1968

Registered User.
Local time
Yesterday, 20:31
Joined
May 9, 2018
Messages
131
I'm not able to get this Not In List event to function on this form.


The event opens another form to add the data to the table that supplies the values to the combo box.



The data is entered into the table.


However, the combo box does not immediately show the new value and I get the message that MS Access cannot find the related data.


I've attached a piece of the database with the forms.


I use this same code and entry form on other not in list events without issue - which leads me to believe the issue might be related to the structure of the combo box.



Here is the code:


Code:
Private Sub SupplementalReviewer_NotInList(NewData As String, Response As Integer)
Response = acDataErrContinue
Me.SupplementalReviewer.Undo
Call Reviewer_Not_Found(NewData)
Me.SupplementalReviewer.Value = NewData
End Sub

Public Sub Reviewer_Not_Found(NewData)
Dim ans As Variant

gbl_exit_name = False

ans = MsgBox(NewData & " is not a listed reviewer in the Database.  Do you want to add them?", _
vbYesNo, "Add New Reviewer?")

If ans = vbNo Then
Me.SupplementalReviewer = Null
DoCmd.GoToControl "Reviewer"
GoTo exit_it
End If



DoCmd.OpenForm ("frmEnterNewReviewer")
Form_frmEnterNewReviewer.Reviewer = NewData


DoCmd.GoToControl "Reviewer"
exit_it:
End Sub
 

Attachments

  • Database71.accdb
    464 KB · Views: 85

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 20:31
Joined
Oct 29, 2018
Messages
21,453
Hi. Have you considered simply using the List Items Edit Form property instead of the Not In List event? Just curious...
 

andy1968

Registered User.
Local time
Yesterday, 20:31
Joined
May 9, 2018
Messages
131
Yes, however, I need to add additional data to the record - such as e-mail, phone number, etc.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 20:31
Joined
Oct 29, 2018
Messages
21,453
Yes, however, I need to add additional data to the record - such as e-mail, phone number, etc.
Hi. Not sure you understood my suggestion. Using the List Items Edit Form property, won't stop you from adding any and all data you want to the source table.
 

andy1968

Registered User.
Local time
Yesterday, 20:31
Joined
May 9, 2018
Messages
131
That works.


However, the user then has to manually type in the new record into the entry form.


Is there a way that I could get the NewData to automatically populate the corresponding control in the entry form?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 20:31
Joined
Oct 29, 2018
Messages
21,453
That works.

However, the user then has to manually type in the new record into the entry form.

Is there a way that I could get the NewData to automatically populate the corresponding control in the entry form?
Hi. You can refer to the combo on the other form to put it in the data entry form. For example:
Code:
Me.TextboxName = Forms!OtherFormName.TextboxName
 

andy1968

Registered User.
Local time
Yesterday, 20:31
Joined
May 9, 2018
Messages
131
Yeah, I thought of that.


The limitation is that I use this entry form from many other forms.


I could fire that code only if the specific form is open.


Rather just get the NotInList event to work.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 20:31
Joined
Oct 29, 2018
Messages
21,453
Yeah, I thought of that.

The limitation is that I use this entry form from many other forms.

I could fire that code only if the specific form is open.

Rather just get the NotInList event to work.
Hi. Should not be a problem to check if a form is open, but it's always up to you, of course.
 

andy1968

Registered User.
Local time
Yesterday, 20:31
Joined
May 9, 2018
Messages
131
Got it to work.


The data source for the form had 2 tables. I eliminated the other table and it worked.


I'm not sure why, but this works for me.


Thanks again for all the ideas.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 20:31
Joined
Oct 29, 2018
Messages
21,453
Got it to work.

The data source for the form had 2 tables. I eliminated the other table and it worked.

I'm not sure why, but this works for me.

Thanks again for all the ideas.
Hi. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom