How to select one item in a listbox to requery subform

Y

Ynot

Thanks for the response. I tested the suggestion and no luck.

This is what I have after I restrict the search in the listbox.

If List0.ListCount = 1 Then
List0.Selected(0) = True
Me.RecordsetClone.FindFirst "[ID] = " & Me![List0]
Me.Bookmark = Me.RecordsetClone.Bookmark
Form.Refresh
[FrmMemberData].Requery < Subform
End If

What can I do to automatically query the subform if only one item remains in
the listbox??

It seems the query works but when the list box is reduced to one item I
can't automatically select that one item before the requery!!!!
 
G

Guest

Try the following:

declare a variable to hold the Id for the first record in the list box:

Dim lngRecID as long

then:

If List0.ListCount = 1 Then
lngRecID = Me.List0.ItemData(0)
Me.List0.Value = lngRecID
Me.RecordsetClone.FindFirst "[ID] = " & lngRecID
Me.Bookmark = Me.RecordsetClone.Bookmark
me.Requery
end if
 
Y

Ynot

THAT WORKED....

THANX!!!!

Mr B said:
Try the following:

declare a variable to hold the Id for the first record in the list box:

Dim lngRecID as long

then:

If List0.ListCount = 1 Then
lngRecID = Me.List0.ItemData(0)
Me.List0.Value = lngRecID
Me.RecordsetClone.FindFirst "[ID] = " & lngRecID
Me.Bookmark = Me.RecordsetClone.Bookmark
me.Requery
end if

--
HTH

Mr B


Ynot said:
Thanks for the response. I tested the suggestion and no luck.

This is what I have after I restrict the search in the listbox.

If List0.ListCount = 1 Then
List0.Selected(0) = True
Me.RecordsetClone.FindFirst "[ID] = " & Me![List0]
Me.Bookmark = Me.RecordsetClone.Bookmark
Form.Refresh
[FrmMemberData].Requery < Subform
End If

What can I do to automatically query the subform if only one item remains
in
the listbox??

It seems the query works but when the list box is reduced to one item I
can't automatically select that one item before the requery!!!!
 
G

Guest

Your quite welcom. Glad to help.
--
HTH

Mr B


Ynot said:
THAT WORKED....

THANX!!!!

Mr B said:
Try the following:

declare a variable to hold the Id for the first record in the list box:

Dim lngRecID as long

then:

If List0.ListCount = 1 Then
lngRecID = Me.List0.ItemData(0)
Me.List0.Value = lngRecID
Me.RecordsetClone.FindFirst "[ID] = " & lngRecID
Me.Bookmark = Me.RecordsetClone.Bookmark
me.Requery
end if

--
HTH

Mr B


Ynot said:
Thanks for the response. I tested the suggestion and no luck.

This is what I have after I restrict the search in the listbox.

If List0.ListCount = 1 Then
List0.Selected(0) = True
Me.RecordsetClone.FindFirst "[ID] = " & Me![List0]
Me.Bookmark = Me.RecordsetClone.Bookmark
Form.Refresh
[FrmMemberData].Requery < Subform
End If

What can I do to automatically query the subform if only one item remains
in
the listbox??

It seems the query works but when the list box is reduced to one item I
can't automatically select that one item before the requery!!!!
 

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