C
Chuck
Thanks for the replies... I am re-posting.
The table has many fields, but the only one that is necessary for this
solution is called TECHNAMES.
The field is built from a form where a user selects multiple last names of
people in a list box. Once the user selects the names, a SAVE button then
updates the field with the selected last names in the format of NAME, NAME,
NAME, NAME..... The names are separated by commas, except the last name in
the field where it just ends with a blank.
IE: ROSSI, SMITH, JONES, CLARK
Reports and other forms list the names in that order.
The design may be flawed in the sense that names are stored in a single
field, but its something that has worked well. Until, someone changes their
last name and we have to then globally edit the entire table to edit the
name.
A form is used to do this, however, if the person's name changes from ROSSI
to SMITH and there is no other characters that equal to ROSSI, then we have
a successful name change to SMITH. The problem is, using INSTR in a query,
if there is someone named ROSSINI, then its still updates it SMITHNI, which
of course is incorrect.
I have been playing around with the query and the INSTR, adding a ", " to
the check and it does indeed pick up "ROSSI, ", but not if ROSSI is the only
one in the field, or the last name in the field when no commas are present.
I then added an OR to the INSTR, hoping that that I can run the query with
two INSTR's, one checking for the "ROSSI, " (comma) and one checking for
"ROSSI " (space). The query returns no results, as if the OR is not being
handled like I thought it would.
Here is the SQL from the query.
SELECT tblTurnoverLog.EntryDate, tblTurnoverLog.JCN, tblTurnoverLog.WES,
tblTurnoverLog.TechNames, tblTurnoverLog.DiscType, tblTurnoverLog.ID,
tblTurnoverLog.ShopName
FROM tblTurnoverLog
WHERE (((tblTurnoverLog.DiscType)<3) AND
((tblTurnoverLog.ShopName)=[Forms]![frmTableMaintenance]![frmTechnicianssubform]![Shopname])
AND
((InStr(1,[technames],[Forms]![frmTableMaintenance]![frmTechnicianssubform]![Name]))>0))
ORDER BY tblTurnoverLog.EntryDate;
Hope that helps. Thanks again.
Chuck
The table has many fields, but the only one that is necessary for this
solution is called TECHNAMES.
The field is built from a form where a user selects multiple last names of
people in a list box. Once the user selects the names, a SAVE button then
updates the field with the selected last names in the format of NAME, NAME,
NAME, NAME..... The names are separated by commas, except the last name in
the field where it just ends with a blank.
IE: ROSSI, SMITH, JONES, CLARK
Reports and other forms list the names in that order.
The design may be flawed in the sense that names are stored in a single
field, but its something that has worked well. Until, someone changes their
last name and we have to then globally edit the entire table to edit the
name.
A form is used to do this, however, if the person's name changes from ROSSI
to SMITH and there is no other characters that equal to ROSSI, then we have
a successful name change to SMITH. The problem is, using INSTR in a query,
if there is someone named ROSSINI, then its still updates it SMITHNI, which
of course is incorrect.
I have been playing around with the query and the INSTR, adding a ", " to
the check and it does indeed pick up "ROSSI, ", but not if ROSSI is the only
one in the field, or the last name in the field when no commas are present.
I then added an OR to the INSTR, hoping that that I can run the query with
two INSTR's, one checking for the "ROSSI, " (comma) and one checking for
"ROSSI " (space). The query returns no results, as if the OR is not being
handled like I thought it would.
Here is the SQL from the query.
SELECT tblTurnoverLog.EntryDate, tblTurnoverLog.JCN, tblTurnoverLog.WES,
tblTurnoverLog.TechNames, tblTurnoverLog.DiscType, tblTurnoverLog.ID,
tblTurnoverLog.ShopName
FROM tblTurnoverLog
WHERE (((tblTurnoverLog.DiscType)<3) AND
((tblTurnoverLog.ShopName)=[Forms]![frmTableMaintenance]![frmTechnicianssubform]![Shopname])
AND
((InStr(1,[technames],[Forms]![frmTableMaintenance]![frmTechnicianssubform]![Name]))>0))
ORDER BY tblTurnoverLog.EntryDate;
Hope that helps. Thanks again.
Chuck