Trim format question?

  • Thread starter Thread starter a24t42
  • Start date Start date
A

a24t42

I have a simple format question.

I have a field called -
ID - custom counter, long number, needs to be 4 characters. I have set
format to 0000. I use DLookup to find this number.

I want to display the number with "SREG" in front of it. I have tried

Control Source: ="SREG" &
DLookUp("[NextAvailableCounter]","CounterTable")

when I do this the number gets trimmed. Say the next number is 0362. I
get SREG362. I want SREG0362. Is there a way to make sure that number
is not trimmed.

Hope that makes sense. Any hekp would be apprecieted.
 
Use the following expression:

="SREG" &
Format(Nz(DLookUp("[NextAvailableCounter]","CounterTable"),1),"0000")

Ken Sheridan
Stafford, England
 
Use the following expression:
Thank you Ken. That worked perfectly.

Judy


="SREG" &
Format(Nz(DLookUp("[NextAvailableCounter]","CounterTable"),1),"0000")

Ken Sheridan
Stafford, England

I have a simple format question.
I have a field called -
ID - custom counter, long number, needs to be 4 characters. I have set
format to 0000. I use DLookup to find this number.
I want to display the number with "SREG" in front of it. I have tried
Control Source: ="SREG" &
DLookUp("[NextAvailableCounter]","CounterTable")
when I do this the number gets trimmed. Say the next number is 0362. I
get SREG362. I want SREG0362. Is there a way to make sure that number
is not trimmed.
Hope that makes sense. Any hekp would be apprecieted.
 
I have a simple format question.

I have a field called -
ID - custom counter, long number, needs to be 4 characters. I have set
format to 0000. I use DLookup to find this number.

I want to display the number with "SREG" in front of it. I have tried

Control Source: ="SREG" &
DLookUp("[NextAvailableCounter]","CounterTable")

when I do this the number gets trimmed. Say the next number is 0362. I
get SREG362. I want SREG0362. Is there a way to make sure that number
is not trimmed.

Hope that makes sense. Any hekp would be apprecieted.

Accedss does not store preceding zero's in a Number datatype field.
You can DISPLAY the number with preceding zeros by formatting the
control that displays them.
When you use the DLookUp, what you get is the actual data, not the
formatted data.

Just format the data again.

="SREG" & Format(DLookUp("[NextAvailableCounter]",
"CounterTable"),"0000")

will return "SREG0362" as a string.
 

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

VLOOKUP Converted to VB 1
Trim 1
Having problem with MultiUser Counter 1
Access Access anti-trim?? 0
Excel Conditional Formatting 1
Number isssue 11
deleting record with a range 2
Format one field in bold in a trim expression 5

Back
Top