Should Be Simple

dsellers1

Registered User.
Local time
Today, 04:27
Joined
May 19, 2009
Messages
39
On one of my forms, I simply have one combo box that will update another combo box based on information in a table. However, there will be times that the information being entered will not be on the table as it is not a reoccurring item. How do I stop these instances from causing a debug error when it doesn't match the data on the table? Is there an End If statement I could use? Here's my code:

Private Sub Combobox1_BeforeUpdate(Cancel As Integer)
Me.Combobox2.Requery
'me.Combobox2 = Me.Combobox2.ItemData()
End Sub

Private Sub Combobox1_AfterUpdate()
Me.Combobox2.Requery
Me.Combobox2 = Me.Combobox2.ItemData(0)
End Sub
 
You could try...

On Error Resume Next

...under each *Private Sub* line. However, don't you want your Users to be able to add that entry to the table?
 
"On Error Resume Next" worked. Thanks!

However, don't you want your Users to be able to add that entry to the table?

Actually, I do. I currently have it set up to where they can add/submit new data to the table prior to entering it in the combo box but nothing after. Now since I have the error fixed, it would be nice to simply have a button that could be pressed to update the table with what was manually entered into combobox1 and combobox2. If you have the code handy, I would be happy to take it off your hands!
 

Users who are viewing this thread

Back
Top Bottom