Select First 2 Characters

themanof83

Registered User.
Local time
Today, 19:54
Joined
May 1, 2008
Messages
73
Hi,
I am trying to use a query to select the first two characters from a field I have created in a form. I would then like to use these 2 letters to filter out results in the query.

For example:

I have a number of sections in a document (1a - TAKE OFF, 1b - LANDING, 1c - STATIC etc.) which include associative chapters (1a.Contents, 1a.Introduction etc.).
From a combo box I select the section (i.e. 1a - TAKE OFF), I then want to filter out all the chapters in the associative section (i.e. 1a.Contents, 1a.Introduction etc) by using the first two characters of this combo box in the query.....

I hope this makes sense!!!

Cheers
 
you can use this as to get the first 2 chars, and use as the recordsource of your combo box

Code:
SELECT Left([yourtable]![yourfield],2) AS 2char
FROM Table1
GROUP BY Left([yourtable]![yourtable],2)

your query will look something like this

Code:
SELECT yourtable.yourfield
FROM Table1
WHERE ((Left([yourtable]![yourfield],2)=[Forms]![yourform]![yourcombobox]));
 
Excellent,

Cheers Kiwiman
 

Users who are viewing this thread

Back
Top Bottom