Problem with Selected() and Requery on form

T

Thomas

I have a form, Form1, with a listbox, Listbox1.
The rowsource of Form1 is based on what is selected in listbox1.
The AfterUpdate-event of listbox1 requery the form and the selected record
is shown. Works fine.

I have a button to open a dialogform (Form2) for adding new records.
When i close Form2 i requery the listbox1 on Form1 and runs a Loop to select
the new item in the listbox.

Code is like this:

For I = 1 To Forms!frmMain!frmActive.Form!lstBestallare.ListCount - 1
If Forms!frmMain!frmActive.Form!lstBestallare.ItemData(I) = IntNew
Then
Forms!frmMain!frmActive.Form!lstBestallare.Selected(I) = True
Forms!frmMain!frmActive.Form.Requery
End If
Next I

This is also working fine. The new row (record) is in Listbox1 on Form1 and
it is selected.

But I have to click the row to have the new record shown. I want it to
display the new record immediatelly without clicking.
I have tried to requery Form1 but no difference. Anyone have an idea what to
do?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top