Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blank Space in field

Status
Not open for further replies.

Lewy

Technical User
Nov 16, 2001
170
GB
I have the following code attached to a button which takes a value that I have inputted into an undefined field on the form and should insert that number of records, filling the first field with a space. For instance I may want 10 blank records before the normal records start in a table ( does this make sense?)

var
i, x longint
endvar


edit()
i=spaces.value

moveto("PartNo")

for x from 1 to i


insertrecord()
sleep()
sendkeys("{vk_space}")
dodefault
endfor
endedit()

This code fails to insert a space into the field. I am sure it is something simple.

Thanks

Lewy
 
Simple?

Yes. Paradox doesn't allow text (alpha) fields to end with a space; it automagically deletes trailing spaces from text fields.

Tony McGuire
"It's not about having enough time; we have the rest of our lives. It's about priorities.
 
Thanks Tony,

The process works manually. In edit mode I can press "insert" followed by pressing the spacebar, "insert" again & so on. It is just very tedious if I need to say add 67 blank records, so I thought it could be easily automated.

Lewy
 
Hmmm.

Are you able to go back to those records, and is the space still there?

Instead of using sendkeys(), can you not then just assign a field value of " "?

partno=" "

From everything I've learned and experienced, Paradox deletes trailing spaces from alpha fields. If your alpha field contains only a space, that's a new one on me.

Also, do you need blank records, or [otherwise empty] records with a blank in that field?


Tony McGuire
"It's not about having enough time; we have the rest of our lives. It's about priorities.
 
Yes, once the space is there, the record stays put. The table lists a part number with a retail price. The table is then merged with a word document to produce a price ticket with the price and part number printed on it. Each sheet of price labels contains about 189 small labels. I may only want to use the first 30 labels and rather than waste the remaining sheet, next time I count the number of labels already used and merge blank labels the next run of printing. Is that clear? Hence the blank record. As I said if I open the table I can manually insert a record, press spacebar, insert another record and continue until I have the desired number of empty records.

Paradox can be so frustrating at times!

Lewy
 

OK.

But my question still stands. Is the space still there if you go back to one of those records?

Can you not create a dummy field, that doesn't print on the labels, and add information in that field - thereby getting an empty record (for the purpose of those labels, anyway)?

Just a thought.

And if you don't want to put this 'extra' field on the form, you could use the dmPut() function to add the value to the field.

Tony McGuire
"It's not about having enough time; we have the rest of our lives. It's about priorities.
 
Also, have you tried adding

postrecord()
unlockrecord()

after the sendkeys()?

Since you aren't using a uiObject, you might try doing that as well; and then using the uiObject in conjunction with the post/unlock.

Just some idears.


Tony McGuire
"It's not about having enough time; we have the rest of our lives. It's about priorities.
 
postrecord()
unlockrecord()

Didn't make any difference.

I think the easiest way will be to add a dummy field.

I just find it hard to comprehend that something so simple can be done manually but not via code. I suppose that's the paradox of Paradox!

Also I looked at the table in tableview, inserted some records with a space in the field. I wasn't able to remove the space using backspace or delete, and the record disappear. The only way to remove the record was to use ctrl delete, whereas with code the field won't accept the space. Have you tried this on a dummy table? Table structure is field1 = A10, field 2 = $. A sample entry for a record would be 1002200801, £125

Thanks,

Lewy
 
Just to say I have added a dummy field and it works a treat.
Many thanks Tony

Lewy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top