I've removed the flickering from the continuous form, but I don't understand how it works. Perhaps there is another, clearer solution, or a different approach. I'll get to the details. I created a cascading combobox with a progressive filter (search as you type) in continuous form. However, I later noticed that when switching from a new record to any previous record - the form flickered. I solved the flickering problem using code:
Additionally, I have to change the properties of the combo that is close to the record selectors. Border width = Hairline; Left = 0,019cm. The idea was to move it a little bit from the record selectors, otherwise there was a little flick on the record selectors.
The idea behind the code was to create and save a new record before actually updating it. It worked. "On Error Resume Next" is neccesary to remove probable errors. But maybe when errors occur it does not flick. I tested - this is a solution to the flickering problem (attached). However, I do not understand how it works. Maybe there is a better way to solve this kind of flickering problems? I know there are API solutions, but I am wondering if I can do it without any API.
Code:
Private Sub Form_Dirty(Cancel As Integer)
On Error Resume Next
If Me.NewRecord Then
Me.Recordset.AddNew
Me.Recordset!ItemID = DMax("ItemID", "TestOrders") + 1 ' to make sure that primary key is non-zero
Me.Recordset.Update
End If
End Sub
The idea behind the code was to create and save a new record before actually updating it. It worked. "On Error Resume Next" is neccesary to remove probable errors. But maybe when errors occur it does not flick. I tested - this is a solution to the flickering problem (attached). However, I do not understand how it works. Maybe there is a better way to solve this kind of flickering problems? I know there are API solutions, but I am wondering if I can do it without any API.