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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PROBLEM - INSTR FUNCTION

Status
Not open for further replies.

dridgeway

Technical User
Jun 3, 2003
16
The following works great in my parameter query - as long as I don't try to find 2 or more characters.

Example: If I enter the letter "C", all is fine and I get all C's returned (because only 1 C string will ever be populated in the field), however, If I enter PA in the parameter query...I receive the P's in addition to the PA's..I juust want the PA's

((InStr(" & strFreight & ",[DPL].[PRECOL3RD])) > 0 Or (InStr(" & strFreight & ",[DPL].[PRECOL3RD])) Is Null)

Can anyone help
 



Hi,

INSTR function
[tt]
MyPos = Instr(SearchString, SearchChar)
[/tt]
your examples seem to have...
[tt]
MyPos = Instr(SearchChar, SearchString)

[/tt]



Skip,

[glasses] [red][/red]
[tongue]
 
My Field [DPL].[PRECOL3RD] is a 3 digit field, strFreight is a text box in a form (for entry)...are you suggesting simply turning them around like this:

((InStr([DPL].[PRECOL3RD]," & strFreight & ")) > 0 Or (InStr([DPL].[PRECOL3RD]," & strFreight & ")) Is Null)


From my form, I'm asking the user to
"ENTER FREIGHT TERMS, seperated by commas <Blank for All>"
 
Yes. This works...
Code:
    sSQL = sSQL & "SELECT DISTINCT"
    sSQL = sSQL & "  `'0-30 pivot$'`.Part"
    sSQL = sSQL & ", [b]instr(Description,'" & [E1] & "')[/b]"
    sSQL = sSQL & ", `'0-30 pivot$'`.Description"
    sSQL = sSQL & vbCrLf
    sSQL = sSQL & "FROM `d:\30-60-90_mach_427_429_XSMN`.`'0-30 pivot$'`"
The other thing is that you need single [red]'quotes'[/red]...
Code:
((InStr([DPL].[PRECOL3RD],[b][red]'[/red][/b]" & strFreight & "[b][red]'[/red][/b])) > 0 Or (InStr([DPL].[PRECOL3RD],[b][red]'[/red][/b]" & strFreight & "[b][red]'[/red][/b])) Is Null)

Skip,

[glasses] [red][/red]
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top