Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access Mid query

Posted on 2010-11-29
8
Medium Priority
?
500 Views
Last Modified: 2012-05-10
Hi,

Does anyone have the code to specify the return of values that are "D" or "P" in the third character of a sequence

So, for example

J3PI009C - Return
K4SI008T - Dont return
KKDI007X - Return

I am using the design view.

Thanks
Seamus
0
Comment
Question by:Seamus2626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 9

Accepted Solution

by:
Ramanhp earned 668 total points
ID: 34229433
if (Mid (UrCharacter, 3, 1) = 'P') or (Mid (UrCharacter, 3, 1) = 'D') then
'your Return Statement here
end if
0
 

Author Comment

by:Seamus2626
ID: 34229512
Thanks Ramanhp, but that didnt do anything.

I uploaded a screen shot of how i interpreted your code

Thanks
Seamus
ss.doc
0
 
LVL 19

Assisted Solution

by:MINDSUPERB
MINDSUPERB earned 668 total points
ID: 34229534
Seamus,

Try this one in a query in design view:

Sample: IIf(InStrRev([YourField],"P")=3 Or InStrRev([YourField],"D")=3,[YourField],"")

Sincerely,
Ed
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Seamus2626
ID: 34229620
Hi Ed,

Thanks for that.

However, this is not working either. I may be doing something wrong here but i cant see it.

I attached a ss of my query

Thanks
Seamus
ss.doc
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 34229642
Seamus,

You need to put it in a new column field not in a criteria.

When properly placed, it will add a column field Sample when you run the query.

Ed
0
 
LVL 2

Assisted Solution

by:compTrack
compTrack earned 664 total points
ID: 34229824
Hi There,

I think you have misunderstood Ramanhp ... his code would work. However, you'll need to use his IIF Statement to suite your scenario.

After seeing both your attachments, I reconstructred your query on my computer and have suggested the solution in the attachment. The only difference is that your query has a "Total: Group By" and mine does not. Also, dont worry about the "Expr1:" on my suggested solution. These does not matter, you can leave your query the way it is. Only add the bit in the criteria which is:

IIf(Mid([TRANS_REF],3,1)='P' Or Mid([TRANS_REF],3,1)='D',[TRANS_REF])

Best Regards,

compTrack
Mid-Solution-For-Third-Sequence.docx
0
 
LVL 31

Expert Comment

by:hnasr
ID: 34230626
Try this for table a with a field adesc

SELECT a.adesc
FROM a
WHERE Eval(adesc Like "??D*" Or adesc like "??P*") <>False
0
 

Author Closing Comment

by:Seamus2626
ID: 34232559
Thanks for the help guys, worked out fine.

Sorry for the late response.

Cheers,
Seamus
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question