A part of numbers

G

Guest

Hi,
My table has field named CodeID that has 11 numbers. Ex: 10002562787.


In a query I want to pull just the last 7 digits of the field and not the
first 4.

Any ideas? What expression I can use in criteria ?

Thanks
chi
 
G

Guest

Thanks for sending me the tips for Access users.

For my question, I tried Right() and I recieved " The expression you entered
has a function containing the wrong number of arguments".

Thanks
Chi
 
A

Allen Browne

Press Ctrl+G to open the Immediate window.
Choose help from the Help menu.
Search for Right()

You will find details of the 2 arguments you need to supply, i.e. the name
of the field to parse, and the number of characters you want.
 
A

Allen Browne

Where did you put this expression?
In report design view, you need a text box in (probably) the Detail section,
and set its ControlSource to:
=Right([CodeID],7)
Make sure the Name of this text box is not CodeID, or the same as any other
field name.

Until you get it sorted out, you could place a CodeID text box alongside it
so that you can make sense of the results.
 
G

Guest

Hi Allen
It works in report! Thank you very much.
----------------------------
In the previous post, I put the expression, Right([CodeID],7) in Query
design view at criteria line and the query showed empty. Sorry, I put it in
query design view, not report design view.

Do you have any ideas why it did not work in query? Please help.
Chi

Allen Browne said:
Where did you put this expression?
In report design view, you need a text box in (probably) the Detail section,
and set its ControlSource to:
=Right([CodeID],7)
Make sure the Name of this text box is not CodeID, or the same as any other
field name.

Until you get it sorted out, you could place a CodeID text box alongside it
so that you can make sense of the results.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

Chi said:
Hi Allen,
I tried Right([CodeID],7) and the report shows empty.
 
A

Allen Browne

Well, if you put it in the *Criteria*, under a field that did not have
exactly those 7 characters, you would get no results returned from your
query.

Perhaps you intended to put it into the Field row in query design, as a
calculated field.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Chi said:
Hi Allen
It works in report! Thank you very much.
----------------------------
In the previous post, I put the expression, Right([CodeID],7) in Query
design view at criteria line and the query showed empty. Sorry, I put it
in
query design view, not report design view.

Do you have any ideas why it did not work in query? Please help.
Chi

Allen Browne said:
Where did you put this expression?
In report design view, you need a text box in (probably) the Detail
section,
and set its ControlSource to:
=Right([CodeID],7)
Make sure the Name of this text box is not CodeID, or the same as any
other
field name.

Until you get it sorted out, you could place a CodeID text box alongside
it
so that you can make sense of the results.


Chi said:
Hi Allen,
I tried Right([CodeID],7) and the report shows empty.
 
G

Guest

Excellent!
Thank you so much! I got it. I also thanks for your patience.
Chi

Allen Browne said:
Well, if you put it in the *Criteria*, under a field that did not have
exactly those 7 characters, you would get no results returned from your
query.

Perhaps you intended to put it into the Field row in query design, as a
calculated field.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Chi said:
Hi Allen
It works in report! Thank you very much.
----------------------------
In the previous post, I put the expression, Right([CodeID],7) in Query
design view at criteria line and the query showed empty. Sorry, I put it
in
query design view, not report design view.

Do you have any ideas why it did not work in query? Please help.
Chi

Allen Browne said:
Where did you put this expression?
In report design view, you need a text box in (probably) the Detail
section,
and set its ControlSource to:
=Right([CodeID],7)
Make sure the Name of this text box is not CodeID, or the same as any
other
field name.

Until you get it sorted out, you could place a CodeID text box alongside
it
so that you can make sense of the results.


Hi Allen,
I tried Right([CodeID],7) and the report shows empty.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top