Solved

Access Mid query

Posted on 2010-11-29
8
490 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 167 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 167 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
Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

 

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 166 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 30

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

691 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