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!

any idea for how to copy the order from OE and insert as a new order??

Status
Not open for further replies.

kent01142

Programmer
Sep 26, 2012
26
HK
i have no idea what's wrong with my code

first .read the value from table and put them into Dim and then adsOEORDD.cancel
adsOERODD.init

after that insert value into adsOEORDH and adsOEORDD

the result is I can insert the value into header but cannot insert into details

so what's wrong with it?
 
How long is a piece of string?
You're going to have to be more specific than that....
 
my code is something like this

Dim data as string
Dim data2 as string
.
.
.
Dim LINE as Long
Dim NUMOFLINE as string

NUMOFLINE = adsOEORDH.fields("ORDLINES")


data = adsOEORDH.fields("CUSTOMER").value
data2 = adsOEORDD.fiedls("ITEM").value

for LINE =1 to NUMOFLINE

adsOEORDD.fields("ITEM")= data2
.
.
.

adsOEORDD.cancel
adsOEORDH.cancel

with adsOEORDD
.RecordClear
.RecordGenerate False
.fields("ITEM").value = data2
.
.
.
.
.insert
end with
next line


with adsOEORDH
.init
.fields("ORDNUMBER").value = newOrderNO
adsOEORDD.cancel

.fields("CUSTOMER").value = data
end with

adsOEORDD.read
adsOEORDH.insert


 
thanks mate for reply but I have no idea of it... sorry about that

Im thinking about is it because when I .read the OEORDD, so OEORDD become a read only view and related to the old ORDUNIQ, so I can't write into the view?

if yes, how can I release the view?
 
OK, so I need to set a new datasource as dsOEORDD?
as Im going to store those data back to OE table
 
it is really a big idea for me, cheers

so let say I created the dsOEORDD, read those data from adsOEORDD and insert into dsOEORDD?
 
thanks for help

I also confuse about should I really need string to store those data and insert back to table or I just need adsOEORDD.read and dsOEORDD.insert?
 
No, not even close. It's more like this:

If OEOrderDetail2.Fields("LINETYPE") = 2 Then
OEOrderDetail2.Fields("MISCCHARGE") = OEOrderDetail.Fields("MISCCHARGE")
OEOrderDetail2.Fields("DESC") = OEOrderDetail.Fields("DESC")
OEOrderDetail2.Fields("EXTINVMISC") = OEOrderDetail.Fields("EXTINVMISC")
Else
OEOrderDetail2.Fields("ITEM") = OEOrderDetail.Fields("ITEM")
OEOrderDetail2.Fields("DESC") = OEOrderDetail.Fields("DESC")
OEOrderDetail2.Fields("LOCATION") = OEOrderDetail.Fields("LOCATION")
OEOrderDetail2.Fields("QTYORDERED") = OEOrderDetail.Fields("QTYORDERED")
OEOrderDetail2.Fields("ORDUNIT") = OEOrderDetail.Fields("ORDUNIT")
OEOrderDetail2.Fields("UNITCOST") = OEOrderDetail.Fields("UNITCOST")
OEOrderDetail2.Fields("UNITWEIGHT") = OEOrderDetail.Fields("UNITWEIGHT")
OEOrderDetail2.Fields("EXPDATE") = OEOrderDetail.Fields("EXPDATE")
OEOrderDetail2.Fields("PRIUNTPRC") = OEOrderDetail.Fields("PRIUNTPRC")
OEOrderDetail2.Fields("PICKSEQ") = OEOrderDetail.Fields("PICKSEQ")
End If

 
I created the dsOEORDD and dsOEORDH, but when I cannot insert value into the table, so should I need to set it as write-able??
 
You're so far off course that's it's not even funny.
First off you do not even say which Accpac version you are working with.
Start with recording a macro while you enter an OE order, you will get all the views that need to be opened and composed.
You need 2 complete sets of OE views opened, 1 set to read the source order and another set to create the new copy.
 
sorry for the missed information but this problem is already fixed

but now what i found another problem after I success to copy the order.

when I create a new order and insert value into the detail in the UI, I got the error message

" Description: Internal error. Order Detail. Operation not allowed. "

so what's wrong with it?

accpac ver is 6.0a and sdk is 5.4a
 
You're doing something that is not allowed, like writing to a read only field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top