Concatenation

A

Adrian Parker

I would like to do a query of two fields (firstName and lastName) and
compare the concatenated value of these two fields (with a signle spaces
added between them) to a string. Can this be achieved in Access?

From VB I have tried the following:

adorecordset.Open "select * from students, instructors " & "WHERE
textcat(textcat(instructors.[firstName], ' '), instructors.[lastName]) = '"
& cmbInstructor.Text & "' AND " & students.instructorCode =
instructors.instructorCode", db, adOpenStatic, adLockPessimistic

It works under SQL I'm told, but the textcat() function does not seem
available in my environment.

What are my options?


Adrian
 
A

Adrian Parker

Adrian Parker said:
I would like to do a query of two fields (firstName and lastName) and
compare the concatenated value of these two fields (with a signle spaces
added between them) to a string. Can this be achieved in Access?

From VB I have tried the following:

adorecordset.Open "select * from students, instructors " & "WHERE
textcat(textcat(instructors.[firstName], ' '), instructors.[lastName]) = '"
& cmbInstructor.Text & "' AND " & students.instructorCode =
instructors.instructorCode", db, adOpenStatic, adLockPessimistic

It works under SQL I'm told, but the textcat() function does not seem
available in my environment.

What are my options?

I know this works, but is it the best option:

adorecordset.Open "select * from students, instructors " _
& "WHERE instructors.[firstName] & ' ' & instructors.[lastName] = '"
& cmbInstructor.Text & "' AND " _
& "students.instructorCode = instructors.instructorCode", _
db, adOpenStatic, adLockPessimistic



Adrian
 

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