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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto fill for a field 1

Status
Not open for further replies.

darlek

Technical User
May 9, 2001
27
GB
i am useing setrange with a tcursor to locate a specific range of records.i.e lotno,description etc one of the fields is stockcode i want to give the selected items the same stock code at the moment i am useing ctrl+d to go down the field and give the records the same code, is there a way of entering the code and it will automatically fill in this field for the selected records. any help would be great, thanks
 
If this is how you want to populate the data, using ctrl-D.
I would use Key Physical and capture that kep strokes.
Then use either tcursor or a query fill in the field
values.
Since I don't know exactly what you are doing, I will take a wild guess.
for tcursor:
Scan tc for myfield = thisvalue
tc.fillfield = WhatEver
EndScan

for query:
q=query

mytable | myfield | FillField |
| ~thisValue | ~WhatEver |

endquery





 
If this is how you want to populate the data, using ctrl-D.
I would use Key Physical and capture that kep strokes.
Then use either tcursor or a query fill in the field
values.
Since I don't know exactly what you are doing, I will take a wild guess.
for tcursor:
Scan tc for myfield = thisvalue
tc.fillfield = WhatEver
EndScan

for query:
q=query

mytable | myfield | FillField |
| ~thisValue | changeto ~WhatEver |

endquery





 
Sorry, this site was going nut on me. Here is what I meant.

If this is how you want to populate the data, using ctrl-D.
I would use Key Physical and capture that kep strokes.
Then use either tcursor or a query fill in the field
values.
Since I don't know exactly what you are doing, I will take a wild guess.
for tcursor:
Scan tc for myfield = thisvalue
tc.fillfield = WhatEver
EndScan

for query:
q=query

mytable | myfield | FillField |
| ~thisValue | changeto ~WhatEver |

endquery



 
thanks for help
questions
do i put the tcursor code in the key physical method for the field stockcode?
what exactly is whatever.
i will give this a go as it seems a simple solution but i dont think i full y understand it.
will let u now how i get on
thanks again
 
hi joe
i ran into variouse problems, i enter the first and last item number i want and click a button which triggers the tcursor and the strange program this gives me the items i want i.e box no's and box weight and stockcode the boxes are despatched and i use stockcode to keep a record of the courier despatch note the boxes went out on.
Boxno Weight Stockcode
10 24
11 20
12 13
stockcode is empty i enter the first stockcode value i.e 678954 and i want this to fill in the other blanks.
i tried your code but i ran into difficulties i put it in the key physical of field Stockcode but it did not like the word for i think it thought it was part of an "if statement"
i am a bit lost is myfield the Stockcode field and does this value relate to the entered value.
please do not flame i really want to understand what i am trying todo.
 
I am puzzled. Did I come across “flame”? I hope not. Never was my intention.

Help me understand what is it you want to do.

You use setrange to get specific records, by which field?
You want to set the stockcode for all the selected records to a specific value.
Where does the stockcode come from?
Are some records have stockcode and some don’t? And fill in the stockcode for those who don’t have one?


 
no you did not flame me i just thought you might think i'm a bit dumb in not understanding fully the workings of the tcursor or that i find it hard to know just where to place the code infact you are being a great help.
o.k i use the set range on the Boxno field which is a keyed field.(i got the code from a paradox unleashed cd)This field has a continuouse imput, as we send out the boxes in 10's or 15 etc i want to record the delivery note they were sent out on, in the table field Stockno. (You are correct that i want to set the stockcode for all the selected records to one value, no records have a stockcode in them to sart with the Stockno field is blank )At the moment i put this field into edit mode and enter the Stockno manually down the field for the selected records.The Stockno comes from the number we have on our courier despatch note, not generated by the computer.
The next set of boxes to be despatched will have a totally different despatch number to be entered in the Stockno field. The idea is that for any box we can keep a permanant record of the despatch note the box went out on and shoulld we have a customer query we can quickly check the record for the box.If it would help i could put a number in the stockcode field default value,then for the selected records change this to the new Stockcode number.I could also put an unbound field on the form and enter the despatch number rather than directly into the Stockno field on the table frame.would either of these help.
thanks for being patient.
 
i think the code may help to understand.
Table is Packer5 fields Boxno, weight, Stockno
Start[ ] and end [ ] unattatched fields
form with :-------------------
buttonA
start[ ] ButtonB end [ ]
Table frame here
----------------------------------
code buttonA
Packer5.switchIndex()

code button B
var
tcpacker5 TCursor
endVar
if not tcPacker5.open("PACKER5") then
errorShow()
endIf
tcPacker5.switchIndex("Boxno")
tcPacker5.setRange(fldStart.value,fldEnd.value)
PACKER5.resync(tcPacker5)

 
forget the above , sorry to mess you around.
i have now removed buttonA, and the switch index as i now realise they are not necessary.
code for button B

var
tcPACKER5 TCursor
endVar
if not tcPACKER5.open("PACKER5") then
errorShow()
endIF
tcPACKER5.setRange(fldStart.value, fldEnd.value)
PACKER5.resync(tcPACKER5)
i tried to insert a version of your code after the setRange line
scan tcPACKER5:
tcPACKER5."Stockno"=" " because it is blank
tcPACKER5.fillfield="3344" just to try a number
endScan
i got error message table needs to be in edit mode to perform function.
Am i at all close
regards
 
I am sorry. If you think you are dumb, you will have to take a number after me. ;-)

The good news, you are almost there.

...
tcPACKER5.EDIT()
scan tcPACKER5:
tcPACKER5."Stockno"=" " because it is blank
tcPACKER5.fillfield="3344" just to try a number
endScan
tcPACKER5.CLOSE()
...

you just need to put tcursor EDIT and CLOSE statements.

Although, I am not sure that how I want to update the data. But if this works for you. Go for it.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top