Apply Filter when Form Loads

MediaDoc

Registered User.
Local time
Today, 06:11
Joined
May 4, 2002
Messages
25
Hi Everyone,

Have a form that is populated from 2 sources.

1. From client information table
2. From an email text string that is parsed for the appropriate fields (i.e. firstname, lastname etc).

The form displays any existing client information if its in the database on one side, and has the email text string contents on the other side.

I want the existing client info to display if the last name from the email text string is the same (i.e. filter the recordset when the form loads).

My filter (in the Form filter properties field is

((tblClientInformation.LastName=Forms!frmClientEntry.pLastName) AND (tblClientInformation.FirstName=Forms!frmClientEntry.pFirstName))

pFirstName / pLastName are from the parsed email text string.

This filter works when I do NOT have a Form_Load event procedure in code. (i.e. when I press the filter icon on the menu bar).

It does not work (nothing is displayed on the existing client information) side of the form when I call it using the Form_Load event procedure.

My code looks like:

Private Sub Form_Load()
Me.FilterOn = True
Me.Requery
End Sub

Any help appreciated!

Thanks,

Matts
 
This won't work because the filter uses values from the form. On the load event, the text boxes on the form are not populated. Try using the on open event of the form and post what you get.
 

Users who are viewing this thread

Back
Top Bottom