Syntax of a Sql statement having a Buil-In Function2

  • Thread starter Thread starter Mota
  • Start date Start date
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.
 
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.
 
Back
Top