UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> field with 177 zeros, Office 2007    
 
   
renee2016
post Aug 4 2010, 06:13 PM
Post #1

UtterAccess Member
Posts: 35



Hi I am new to access. I need to create a blank field that contains 177 zeros. How do I do this. Can I set it as my default value and if so how?

Thanks
Go to the top of the page
 
+
Doug Steele
post Aug 4 2010, 06:25 PM
Post #2

UtterAccess VIP
Posts: 17,638
From: Don Mills, ON (Canada)



Welcome to UtterAccess.

At the risk of seeming condescending, why do you want a field with 177 zeroes in it? Is there some meaning to the fact that there are 177 zeroes? Are you trying to cram 177 different pieces of information into a single field?

While it's likely possible to do what you're trying to do, it sounds as though it's a bad idea to me. I'd strongly recommend you explain what you're trying to do, and one of us can suggest an appropriate way to achieve that end.
Go to the top of the page
 
+
GroverParkGeorge
post Aug 4 2010, 06:32 PM
Post #3

UA Admin
Posts: 19,246
From: Newcastle, WA



Welcome to UtterAccess.

That's a very unusual requirement. But padding a field with zeroes, in itself, is not so hard. What I'm really curious about is this: "set it as my default value "

You can easily set the default value property of a field in that field's Default Propery on the property sheet. However, that implies the field is in a table, and you mention no tables. So, it might be good to start by telling us WHERE this field will live.

And BTW, there is a very distinct difference between a "blank field" and a field that contains 0's regardless of how many there are.

In short, if setting the default value for a field in a table isn't going to meet your requirement, please tell us what the goal is so we can try to give you some more usefull information and suggestions.

George
Go to the top of the page
 
+
renee2016
post Aug 4 2010, 06:42 PM
Post #4

UtterAccess Member
Posts: 35



I am sorry I meant to say I need to pad the field with 177 spaces not zeros. I need to prohibit people from entrying any data in that field.


Sorry for the confusion, this is all new to me.


Thanks

This post has been edited by renee2016: Aug 4 2010, 06:50 PM
Go to the top of the page
 
+
GroverParkGeorge
post Aug 4 2010, 06:59 PM
Post #5

UA Admin
Posts: 19,246
From: Newcastle, WA



Here is a VBA function that inserts X number of spaces.

Space(x)

QUOTE
Space Function


Returns a Variant (String) consisting of the specified number of spaces.

Syntax

Space(number)

The required number argument is the number of spaces you want in the string.

Remarks

The Space function is useful for formatting output and clearing data in fixed-length strings.

That might be what you want, but where and how you'll use it depends on the answer to Pad "what"?

This post has been edited by GroverParkGeorge: Aug 4 2010, 07:28 PM
Reason for edit: Edited Quoted portion of post
Go to the top of the page
 
+
datAdrenaline
post Aug 5 2010, 04:04 AM
Post #6

UtterAccess Editor
Posts: 15,974
From: Northern Virginia, USA



>> I need to prohibit people from entrying any data in that field <<

Padding a field with spaces will not prevent this. As soon as the user tabs into the control bound to field in question, typically the entire value is hilited --- one keystroke will delete the entry and the value will begin to reflect what the user is typing. Or, if that scenario does not pan out, the user can simply hit the delete key while in the control bound to the field in question.

The best way to prevent the user from entering data into a control bound to a field is by setting the controls Locked property to True.
Go to the top of the page
 
+
renee2016
post Aug 5 2010, 08:00 AM
Post #7

UtterAccess Member
Posts: 35



Let me start over. This is my problem.

Our Charter school has to submit data to the state. The requirement for this record is that in positions 1-23 we will have to input our data and in positions 24-200 they want it blank (pad with spaces). So how do I append these blanks to my record so that when we submit this record it has these blank spaces at the end.



I hope this help to clarify want I am trying to accomplish.
Go to the top of the page
 
+
Jeff B.
post Aug 5 2010, 08:36 AM
Post #8

UtterAccess VIP
Posts: 8,170
From: Pacific NorthWet



"... submit data to the State ..."

Instead of storing "nothing" and then sending it, you could store only what YOU need, then use a query to add in the spaces. You could export the query (actually, the query's data).

Good luck!
Go to the top of the page
 
+
Doug Steele
post Aug 5 2010, 08:47 AM
Post #9

UtterAccess VIP
Posts: 17,638
From: Don Mills, ON (Canada)



In other words, your query should have Left([SomeField], 23) & Space(177) rather than [SomeField]
Go to the top of the page
 
+
Daryl S
post Aug 5 2010, 09:37 AM
Post #10

UtterAccess VIP
Posts: 2,270
From: Colorful Colorado



To add on to Doug's post...

In your output query (that you need to export to a text file) you should use this:

Left(Left([SomeField],23) & Space(200),200)

This will handle cases where your data is less than 23 characters wide, but will also limit your data to only 23 characters of the 200.

Go to the top of the page
 
+
datAdrenaline
post Aug 5 2010, 11:20 AM
Post #11

UtterAccess Editor
Posts: 15,974
From: Northern Virginia, USA



Adding to the many fine reply's, I would advise you to set your field size to 23 for the field you wish to limit to 23 characters. Then here is yet another expression:

Left([SomeField] & Space(200),200)

Which is esentially just like Daryl S's, but there is really no need for the nexted Left() functions when you limit your input field to a size of 23.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 03:44 PM