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!

Best function to extract a value (The word reference) from a string 1

Status
Not open for further replies.

Pack10

Programmer
Feb 3, 2010
495
US
I need to develop a function that will read a string of characters that has the value "Reference 9999" embedded somewhere in it. What is the best function to do this.
Thx
 
Have a look at the InStr function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
From parsing out this string I get a number which I wanted to use in a DLOOKUP. However, I get error 2471. In the debugger if I hardcode a value the DLookup works fine, however I get the 2471 error when I use the value in the variable as part of the dlookup. How can I get around this?
 
Type error maybe? If you parse a "number" out of a string you still have a string.
 
Why not post the code raising the error ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Here's the code
The value in holdparent is something like 122, or 118...

holdParent = Mid$(objMessage, intPos + 9, 5)

strAssignedTo = DLookup"[Assigned_To]", "[Assigned_DDQs]", "[Parent] = holdParent")
 
I actually scrapped this for a findfirst on the recordset and it worked fine. But I really dont understand why the parameter value (mem variable) I was using does not work with DLOOKUP.
 
It is because

>strAssignedTo = DLookup"[Assigned_To]", "[Assigned_DDQs]", "[Parent] = holdParent")

is wrong. Try

DLookup"[Assigned_To]", "[Assigned_DDQs]", "[Parent] = " & holdParent)
 
I will try it but I believe I did try that. Anyway I
Used a findfirst which worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top