I have a data entry form with a tabbed form control for tracking mail our office processes. The first tab is for sending new mail(data entry), second tab is for viewing past mail, third is for printing labels etc. Here's the problem. On my tab for sending mail I have two comboboxes, cboOffice and cboRecipient. From these two comboboxes the user selects which of our offices is to receive the mail, and then the individual. These two combo boxes are part of an option group that from which the user can choose OptionA (select one of our offices) or optionB (manually type an address). I have code in VBA that checks to see if the user has selected optionA and if so it checks to make sure the user has selected both an office and recipient before it will let them continue. The problem is that even though the combo boxes dont have anything in them the database still thinks something is selected and therefore skips over the code checking to see if they are blank. I ve tried adding me.cboOffice=Null and me.cboRecipient=null in several different events and have eliminated the problem of the database thinking the combo boxes have something in them. The problem now is when I try to close the form I get the error "index or primary key cannot be null". neither of the combo boxes are the primary key and I havent entered anything in the form at this point. I just open and close it and get the error. If I remove the me.cboOffice=Null and Me.cboRecipient = null the "index or primary key cannot be null" message goes away but then the database goes back to thinking the combo boxes have a value selected when they do not and therefore skips over the code I have checking to see if they are blank.
8/22/2022 - Mon
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.