for right now, i am using this code to copy the header optional fields
For LINECNT = 1 To 13
With adsOEORDHO
.Fields("ORDUNIQ") = adsOEORDH.Fields("ORDUNIQ")
.Fetch
End With
With dsOEORDHO
.RecordClear
.RecordGenerate False
.Fields("ORDUNIQ") = newORDUNIQ
.Fields("OPTFIELD") = adsOEORDHO.Fields("OPTFIELD")
.Fields("VALUE") = adsOEORDHO.Fields("VALUE")
.Fields("TYPE") = adsOEORDHO.Fields("TYPE")
.Fields("LENGTH") = adsOEORDHO.Fields("LENGTH")
.Fields("DECIMALS") = adsOEORDHO.Fields("DECIMALS")
.Fields("ALLOWNULL") = adsOEORDHO.Fields("ALLOWNULL")
.Fields("VALIDATE") = adsOEORDHO.Fields("VALIDATE")
.Fields("SWSET") = adsOEORDHO.Fields("SWSET")
.Insert
End With
Next LINECNT
First time of the copy order would be prefect but after that the fetch would stay in the last fields (WAYBILL), so it is 100% failed...
just wanna ask how can I reset the fetch to run the second time? I tried to use .init but no luck, so is there any other ways to do it?
another question is I tried to copy the detail optional fields in the same logic as well but the VB said i am writing the value into read-only field, so whats wrong with it?
the last question is how can I count how many data within the OEORDHO which belong to the ORDUNIQ? because using 13 is very stupid i think!
Cheers,
Kent
For LINECNT = 1 To 13
With adsOEORDHO
.Fields("ORDUNIQ") = adsOEORDH.Fields("ORDUNIQ")
.Fetch
End With
With dsOEORDHO
.RecordClear
.RecordGenerate False
.Fields("ORDUNIQ") = newORDUNIQ
.Fields("OPTFIELD") = adsOEORDHO.Fields("OPTFIELD")
.Fields("VALUE") = adsOEORDHO.Fields("VALUE")
.Fields("TYPE") = adsOEORDHO.Fields("TYPE")
.Fields("LENGTH") = adsOEORDHO.Fields("LENGTH")
.Fields("DECIMALS") = adsOEORDHO.Fields("DECIMALS")
.Fields("ALLOWNULL") = adsOEORDHO.Fields("ALLOWNULL")
.Fields("VALIDATE") = adsOEORDHO.Fields("VALIDATE")
.Fields("SWSET") = adsOEORDHO.Fields("SWSET")
.Insert
End With
Next LINECNT
First time of the copy order would be prefect but after that the fetch would stay in the last fields (WAYBILL), so it is 100% failed...
just wanna ask how can I reset the fetch to run the second time? I tried to use .init but no luck, so is there any other ways to do it?
another question is I tried to copy the detail optional fields in the same logic as well but the VB said i am writing the value into read-only field, so whats wrong with it?
the last question is how can I count how many data within the OEORDHO which belong to the ORDUNIQ? because using 13 is very stupid i think!
Cheers,
Kent