Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

(Right$(nod.Key, 5)) 1

Status
Not open for further replies.

hoofit

Technical User
Nov 20, 2005
343
US
In my application, I use (Right$(nod.Key, 5)). The return I'm looking for is "PMH50" which I get with no problem. However, when there are returns like "PMH100" or "PMH1000", how is the function worded to return this?

Thank you kindly

hoof
 
Something like this ?
Mid(nod.Key, InStrRev(nod.Key, "PMH"))

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 


DoCmd.RunSQL "DELETE * FROM PMInterval WHERE PMName='" & Mid(nod.Key, InStrRev(nod.Key, "PMH"))

results in a syntax error

hoof
 
Code:
DoCmd.RunSQL "DELETE * FROM PMInterval WHERE PMName='" & Mid(nod.Key, InStrRev(nod.Key, "PMH"))[!] & "'"[/!]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,

Yup that does it. What does the extra & "'" do at the end of the function? This is the second time I've seen it.

hoof
 
This add the closing single quote for the text value tested for PMInterval in the SQL code:
DoCmd.RunSQL "DELETE * FROM PMInterval WHERE PMName=[!]'[/!]" & Mid(nod.Key, InStrRev(nod.Key, "PMH")) & "[!]'[/!]"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top