Not in list error - 2455 run-time (1 Viewer)

vegemite

Registered User.
Local time
Today, 13:25
Joined
Aug 5, 2019
Messages
64
Aha. Its in the table as a yes/no field. I will add to the form.
 

June7

AWF VIP
Local time
Yesterday, 19:25
Joined
Mar 9, 2014
Messages
5,466
Should probably automate that field and not rely on user to make entry or don't restrict the combobox list.
 

vegemite

Registered User.
Local time
Today, 13:25
Joined
Aug 5, 2019
Messages
64
@June7 can I set the value with OpenArgs in my acFormAdd line?
I did try but its not happy. I added a checkbox to the form directory

DoCmd.OpenForm "frmDirectory", acNormal, , , acFormAdd, acDialog, CmbSubconsultant & Chr(165) & NewData, True
Set Me.ChkSubbie = True
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:25
Joined
May 7, 2009
Messages
19,229
your combo (directory) rowsource must only include "Sub Consultant".
 

Attachments

  • DBClip.zip
    337.4 KB · Views: 80

June7

AWF VIP
Local time
Yesterday, 19:25
Joined
Mar 9, 2014
Messages
5,466
I have reviewed my code again and realized it works because combobox is unbound and has only 1 field in RowSource. Your combobox is bound and has a RowSource with alias - it saves ID but displays name. In your case, setting combobox to NewData fails because this also populates field which expects a number value. Couple options to make my approach work.

1. Pass ID of new tblDirectory record back to calling form and set combobox to that value. Methods of passing value are global variable, TempVars, OpenArgs, one form directly sets value of control on another form, or calling form pulls value from opened form and then closes called form.

2. Loop throuh combobox list until match to NewData is found in the non-bound column.

I have used all these techniques with exception of TempVars.

So unless Arnel has provided a solution, do you want to pursue this further?
 
Last edited:

Users who are viewing this thread

Top Bottom