Requery Method

  • Thread starter Thread starter S Jackson
  • Start date Start date
S

S Jackson

I have a form which contains two list boxes.

The first list box is RptGroupMembers the second is RptListBox.

I want the RptListBox to display the reports that are members of the group
selected by the user in the RptGroupMembers list box. Here is the code I am
trying to use as an Event procedure On Open on the form itself:


Me.RptGroupId.SetFocus
Me.RptGroupId = Me.RptGroupId.Column(0, 0)
DoCmd.Requery RptListBox

This is the error I get:

Run-time error '2498';
The expression you entered is the wrong data type for one of the arguments.

Any help is very much appreciated. Thanks.

S. Jackson
 
I suspect the Open event is a little to early to do this. The form's recordset usually
isn't available until the Load event.

Unless you want the focus there anyway, you shouldn't need to set focus to the combo box
just to set its value. Also, you may find Me.RptListBox.Requery to be more "up to date"
than the DoCmd call.
 
Back
Top