Solved

Access Mid query

Posted on 2010-11-29
8
446 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
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
 

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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now