Requery Method

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
 
W

Wayne Morgan

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.
 

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