Where Condition Help

  • Thread starter Thread starter JamesJ
  • Start date Start date
J

JamesJ

Hi. Trying to open a form and display only records where the
ReminderTypeID field is 3 using the DoCmd object and a
Where Condition:

DoCmd.OpenForm "frmReminders", , , "[ReminderTypeID]" = 3

The form opens with all records displayed. What am I missing?

James
 
That works fine. But I have a listbox I'd like to display the same records.

I've tried Me.RecordSource = Me!lstReminders in the OnOpen of the
form but the list box shows all records.

Thanks,
James

Van T. Dinh said:
Try:

DoCmd.OpenForm "frmReminders", , , "[ReminderTypeID] = 3"


--
HTH
Van T. Dinh
MVP (Access)



JamesJ said:
Hi. Trying to open a form and display only records where the
ReminderTypeID field is 3 using the DoCmd object and a
Where Condition:

DoCmd.OpenForm "frmReminders", , , "[ReminderTypeID]" = 3

The form opens with all records displayed. What am I missing?

James
 
I sounds like you need to filter your ListBox with the same condition???

I am not sure of what you are trying to do with the code you posted but it
is clearly wrong since if you need to change something related to the
ListBox, the ListBox reference must be on the *LHS* of the assignment
statement.
 
I got it. I have a combobox on the form I'm opening that
filters the records based on the selection one makes in the
cbo. I called the cbo_AfterUpdate and the list box displayed
the same records as the form. Actually the form doesn't
display the records but is based on the same data as the
cbo.

Thanks much,
James
 
Back
Top