Search as you type in combobox. (1 Viewer)

MajP

You've got your good things, and you've got mine.
Local time
Today, 13:03
Joined
May 21, 2018
Messages
8,463
Because of how the class works, the native list items edit form will not requery the list, and even if it could I identified a bug in my code. Unfortunately there is no way to trap the event of opening the list value edit form without a lot of code making that feature really complicated to add into the class module. An easy solution would be to use another event instead. I usually set all of my editable listboxes with a double click to edit items or a command button next to it that looks like an add/edit button.

First a fix is needed to the initialize method in the class. Need to add one line
If Not mCombo.RowSource = "" Then
Set rs = CurrentDb.OpenRecordset(TheComboBox.RowSource)
Set mCombo.Recordset = rs
'must add below line, it was missing in the original
mRowSource = mCombo.RowSource
End If

For now did not add the event to the class, but I could. Instead I just added it to the form.

Private Sub cmbProducts_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmaddproducts", , , , , acDialog
faytProducts.Requery
End Sub

The key is now that the requery works you need to use the class requery method after editing the form. Using the not in list event with a find as you type would be really confusing, I would think so I doubt I would go that route and I always thought not in list was just a pain to work with. I like a deliberate edit form
 

Fira_g

Registered User.
Local time
Today, 13:03
Joined
Oct 17, 2019
Messages
60
Because of how the class works, the native list items edit form will not requery the list, and even if it could I identified a bug in my code. Unfortunately there is no way to trap the event of opening the list value edit form without...

Thank you very much for finding time to modify the code to work with the Edit Form.

It works as it should do after I added changes you suggested.

There seems to be some problems with requery when I am checking the CustomerID field form value and opening the selected ID in the edit form or a new record with If statement, but I thing that is because I am not doing something right with my If ... Else statement.

I will be back with more questions later :)
 

Users who are viewing this thread

Top Bottom