Syntax of a Sql statement having a Buil-In Function2

M

Mota

Hello;
I have a table named PrescriptionsTBL ,having a TEXT field named [PatName].I
need a SQL statement that select all fields of this table where the first 3
letters of the field PatName are 'Pat'.So the Sql WITHOUT its quotations
will be something like that:
StrSql="Select * From PrescriptionsTBL Where left([PatName],3)=Pat"
Can anyone please help me to write this statement?I will be so grateful to
you.
Thank you.
 
M

Marshall Barton

Mota said:
I have a table named PrescriptionsTBL ,having a TEXT field named [PatName].I
need a SQL statement that select all fields of this table where the first 3
letters of the field PatName are 'Pat'.So the Sql WITHOUT its quotations
will be something like that:
StrSql="Select * From PrescriptionsTBL Where left([PatName],3)=Pat"

The simple answer is:

StrSql="Select * From PrescriptionsTBL " _
& "Where Left([PatName],3)=""Pat"""

but after reading your other post with what looks like the
same question, I'm not sure I understand the question.
 

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