G
Guest
I have a form called frmPackage with a list box containing a query.
I have part numbers (NPN) in a table called tblPackage that look like this:
123
123BB
123BB
456
456AA
456AA
456B
789
789C
The letters show a child relationship to the number only part-number.
I have made a listbox that contains a query that shows all the matches to
the current record's NPN, but it only shows exact matches. Such as if the
current record is 123, it shows 123 in the list box. If the current record
is 123BB, then it shows the two 123BB records.
I would like the list box to ignore the letters completely and show all the
matching NPNs to the current record's parent portion of the NPN. Like this:
If Current record is 123, then List box shows:
123
123BB
123BB
Or if Current record is 123BB then list box shows:
123
123BB
123BB
This is my current SQL that gives me exact matches only:
SELECT tblPackage.ID, tblPackage.NPN
FROM tblPackage
WHERE (((tblPackage.NNPN)=[Forms]![frmPackage]![NNPN]))
ORDER BY tblPackage.NNPN, tblPackage.ID;
I have tried using the Like statement but it only works properly when the
current record's NPN is numbers only. When the current record's NPN has a
letter suffix it won't show the parent NPN.
SELECT tblPackage.ID, tblPackage.NNPN, tblPackage.SI, tblPackage.[EFS LAR
NO], tblPackage.DeleteRecordFlag
FROM tblPackage
WHERE (((tblPackage.NNPN)=[Forms]![frmPackage]![NNPN] Or (tblPackage.NNPN)
Like [Forms]![frmPackage]![NNPN] & "[a-zA-Z]*"))
ORDER BY tblPackage.NNPN, tblPackage.ID;
I hope this is clear and not convoluted. I am self-taught and the
designated DB person in my group. I have been trying to get this for so long
now I am developing a nervous tick and it feels like a miniature pick-axe is
stuck in the back of my left eyeball.
Any help will be greatly appreciated.
Mike
I have part numbers (NPN) in a table called tblPackage that look like this:
123
123BB
123BB
456
456AA
456AA
456B
789
789C
The letters show a child relationship to the number only part-number.
I have made a listbox that contains a query that shows all the matches to
the current record's NPN, but it only shows exact matches. Such as if the
current record is 123, it shows 123 in the list box. If the current record
is 123BB, then it shows the two 123BB records.
I would like the list box to ignore the letters completely and show all the
matching NPNs to the current record's parent portion of the NPN. Like this:
If Current record is 123, then List box shows:
123
123BB
123BB
Or if Current record is 123BB then list box shows:
123
123BB
123BB
This is my current SQL that gives me exact matches only:
SELECT tblPackage.ID, tblPackage.NPN
FROM tblPackage
WHERE (((tblPackage.NNPN)=[Forms]![frmPackage]![NNPN]))
ORDER BY tblPackage.NNPN, tblPackage.ID;
I have tried using the Like statement but it only works properly when the
current record's NPN is numbers only. When the current record's NPN has a
letter suffix it won't show the parent NPN.
SELECT tblPackage.ID, tblPackage.NNPN, tblPackage.SI, tblPackage.[EFS LAR
NO], tblPackage.DeleteRecordFlag
FROM tblPackage
WHERE (((tblPackage.NNPN)=[Forms]![frmPackage]![NNPN] Or (tblPackage.NNPN)
Like [Forms]![frmPackage]![NNPN] & "[a-zA-Z]*"))
ORDER BY tblPackage.NNPN, tblPackage.ID;
I hope this is clear and not convoluted. I am self-taught and the
designated DB person in my group. I have been trying to get this for so long
now I am developing a nervous tick and it feels like a miniature pick-axe is
stuck in the back of my left eyeball.
Any help will be greatly appreciated.
Mike