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

appending records 1

Status
Not open for further replies.

progfox

Programmer
Jun 15, 2003
43
IN
Dear Sir,

U People have always taken me through whenever I have suffered any problem. Sir Right Now I want to append as many records in the same time in the itemmaster table.

I hav ewriteen The following code for it.........


counter=VAL(thisform.pageframe1.page3.text11.Value)

IF thisform.pageframe1.page3.check1.Value=1
vals1=ALLTRIM(thisform.pageframe1.page3.text1.Value)
vals2=thisform.pageframe1.page3.text2.Value
vals3=thisform.pageframe1.page3.text3.Value
vals4=thisform.pageframe1.page3.text4.Value
vals5=thisform.pageframe1.page3.text5.Value
vals6=thisform.pageframe1.page3.text6.Value
vals7=thisform.pageframe1.page3.text7.Value
vals8=thisform.pageframe1.page3.text8.Value
vals9=thisform.pageframe1.page3.text9.Value
vals10=thisform.pageframe1.page3.text10.Value

itdecs1=thisform.pageframe1.page3.check1.Caption+" "+thisform.pageframe1.page3.combo1.Value+"-"+thisform.pageframe1.page3.combo2.value+"-"+vals1+"-"+thisform.pageframe1.page3.combo3.Value
itdecs2=thisform.pageframe1.page3.check1.Caption+" "+thisform.pageframe1.page3.combo1.Value+"-"+thisform.pageframe1.page3.combo2.value+"-"+vals2+"-"+thisform.pageframe1.page3.combo3.Value
itdecs3=thisform.pageframe1.page3.check1.Caption+" "+thisform.pageframe1.page3.combo1.Value+"-"+thisform.pageframe1.page3.combo2.value+"-"+vals3+"-"+thisform.pageframe1.page3.combo3.Value
itdecs4=thisform.pageframe1.page3.check1.Caption+" "+thisform.pageframe1.page3.combo1.Value+"-"+thisform.pageframe1.page3.combo2.value+"-"+vals4+"-"+thisform.pageframe1.page3.combo3.Value
itdecs5=thisform.pageframe1.page3.check1.Caption+" "+thisform.pageframe1.page3.combo1.Value+"-"+thisform.pageframe1.page3.combo2.value+"-"+vals5+"-"+thisform.pageframe1.page3.combo3.Value
itdecs6=thisform.pageframe1.page3.check1.Caption+" "+thisform.pageframe1.page3.combo1.Value+"-"+thisform.pageframe1.page3.combo2.value+"-"+vals6+"-"+thisform.pageframe1.page3.combo3.Value
itdecs7=thisform.pageframe1.page3.check1.Caption+" "+thisform.pageframe1.page3.combo1.Value+"-"+thisform.pageframe1.page3.combo2.value+"-"+vals7+"-"+thisform.pageframe1.page3.combo3.Value
itdecs8=thisform.pageframe1.page3.check1.Caption+" "+thisform.pageframe1.page3.combo1.Value+"-"+thisform.pageframe1.page3.combo2.value+"-"+vals8+"-"+thisform.pageframe1.page3.combo3.Value
itdecs9=thisform.pageframe1.page3.check1.Caption+" "+thisform.pageframe1.page3.combo1.Value+"-"+thisform.pageframe1.page3.combo2.value+"-"+vals9+"-"+thisform.pageframe1.page3.combo3.Value
itdecs10=thisform.pageframe1.page3.check1.Caption+" "+thisform.pageframe1.page3.combo1.Value+"-"+thisform.pageframe1.page3.combo2.value+"-"+vals10+"-"+thisform.pageframe1.page3.combo3.Value

SELECT MAX(VAL(alltrim(SUBSTR(itemcode,3)))) as new FROM itemmas WHERE ALLTRIM(SUBSTR(itemcode,1,2))="LA" INTO CURSOR xnew1
SELECT itemmas

FOR REC = 1 TO COUNTER STEP 1
GO BOTTOM
APPEND BLANK
REPLACE itemcode WITH "LA"+ALLTRIM(STR(xnew1.new+1))
REPLACE itemcat WITH "LABEL LAW"
REPLACE itemsubcat WITH "LAW"
REPLACE itemdesc WITH &itemdecs+&rec
REPLACE unitmeasur WITH "PCS"
REPLACE convunit WITH "PCS"
REPLACE convrate WITH 1
REPLACE size WITH &vals+&rec
REPLACE buyername WITH thisform.pageframe1.page3.combo1.Value
REPLACE stylename WITH thisform.pageframe1.page3.combo1.Value
ENDFOR
SELECT ITEMMAS
GO BOTT
BROWSE
MESSAGEBOX("DATA SUCCESSFULLY UPDATED")
ENDIF


within the following code I wanted to get the records from the form objects and saving it to the variables.
Now "rec" is the counter variable in the for loop. What I wanted is as variable incremented the variable say now is
itemdecs1 for rec=1
itemdecs2 for rec=2
.
.
.
itemdecsn for rec=n

and the itemdesc field will be replced by this variable .
same as the case of sizes also.

Again I want to increment the code of the item also.



I hope for a favourable response once again.


Thanx & Regards

Chandan

 
hi
select ItemMas
scatter memvar blank
FOR REC = 1 TO COUNTER STEP 1
** GO BOTTOM ... NO NEED FOR THIS LINE
APPEND BLANK
m.itemcode = "LA"+ALLTRIM(STR(xnew1.new+1))
m.itemcat = "LABEL LAW"
m.itemsubcat = "LAW"
m.itemdesc = itemdecs+ALLT(STR(Counter))
m.unitmeasur = "PCS"
m.convunit = "PCS"
m.convrate = 1
m.size = vals+ALLT(STR(Counter))
m.buyername = thisform.pageframe1.page3.combo1.Value
m.stylename = thisform.pageframe1.page3.combo1.Value
INSERT INTO ItemMas FROM MEMVAR
ENDFOR

:)

ramani :)
(Subramanian.G)
 
Dear Mr. Ramani,

Thanx For Ur kind Support. The codes are really helpful and also This gave me the idea about a table type array.


THANK YOU VERY MUCH

RAGARDS

CHANDAN
 
Dear Mr. Ramani ,

Sorry TO Disturb U once more! Well While I was executing the codes provided by U I found there wqas the same error or problem I was facing the Line

" m.itemdesc = itdecs+ALLT(STR(Counter))"/itdesc not found

And its not full filling my requirement.

Pls HElp!!!!!!!!!!!!!!!

Regards

Chandan

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top