Filter sub form results by first letter in Main form field (1 Viewer)

Little_Anj

Registered User.
Local time
Today, 19:11
Joined
Dec 14, 2012
Messages
25
I have a Main form with a sub form.
The main form is a customer record (form view), and the sub form is all other customers (same fields) datasheet view.

I have a navigation bar to filter (using different queries) the results in the sub form
same postcode
Same company (different location)
everyone except Main form customer

I cannot get a different filter (Query) to show only customers whose name begins with the same letter as the customer in the main form?

I have been trying Like but think I am referencing it wrong, as it prompts me to enter a value rather than using the value in the field in the main form.

This is what I have in the query (of the subform)

Customer ID: <>[Forms]![NewAllCustomerListF]![CustomerID]
Customer Name: Like "[Forms]![NewAllCustomerListF]![CustomerName]" & "*"
 

Beetle

Duly Registered Boozer
Local time
Today, 03:11
Joined
Apr 30, 2011
Messages
1,808
You shouldn't have quotes around the form reference in the criteria. Plus, based on your description of what you want, you need to return only the first letter of the customer name. Try this;

Like Left([Forms]![NewAllCustomerListF]![CustomerName],1) & "*"
 

Little_Anj

Registered User.
Local time
Today, 19:11
Joined
Dec 14, 2012
Messages
25
Thanks heaps Sean!! You are a total lifesaver.

I had forgotten about the quotes being there, as I was trying anything.

Thanks again, that worked instantly :)
 

Users who are viewing this thread

Top Bottom