Using Text Functions in Querry

  • Thread starter Thread starter Mario
  • Start date Start date
M

Mario

Lets Say I have table "EmployeeRecords" which has the
following structure and contents:

EmpID EmpName
123456789 Dave
987654321 Matt

What will be the querry that can generate the following
output

EmpName SSN
Dave 123-45-6789
Matt 987-65-4321

The usual text functions (found in MS Excel) like
Concatenate, Left, Mid doesnt seem to work in MS Access.

Please help
 
Mario said:
Lets Say I have table "EmployeeRecords" which has the
following structure and contents:

EmpID EmpName
123456789 Dave
987654321 Matt

What will be the querry that can generate the following
output

EmpName SSN
Dave 123-45-6789
Matt 987-65-4321

The usual text functions (found in MS Excel) like
Concatenate, Left, Mid doesnt seem to work in MS Access.

Please help
Mario,

regarding: > The usual text functions (found in MS Excel) like
Concatenate, Left, Mid doesnt seem to work in MS Access. <

Who says they don't work?

Here is an example using your question::
NewSSNLayout: Left([SSN],3) & "-" & Mid([SSN],4,2) & "-" &
Right([SSN],4)

If you get an error saying that a function can't be found, you have a
reference problem.

Open any module in Design view, or press Ctrl + G.
On the Tools menu, click References.
Click to clear the check box for the type library or object library
marked as "Missing:."

An alternative to removing the reference is to restore the referenced
file to the path specified in the References dialog box. If the
referenced file is in a new location, clear the "Missing:" reference
and create a new reference to the file in its new folder.

See Microsoft KnowledgeBase articles:
283115 'ACC2002: References That You Must Set When You Work with
Microsoft
Access'
Or for Access 97:
175484 'References to Set When Working With Microsoft Access' for
the correct ones needed,
and
160870 'VBA Functions Break in Database with Missing References' for
how to reset a missing one.
 
Yes, it suprised me when I found out how much VB string manipulation can be
used in queries. I think dates still vary in formatting, but MS has very
standardized string manipulation which can be combined with SQL.
(e-mail address removed)
 
Back
Top