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!

Can't read/fetch OEORDD 2

Status
Not open for further replies.

oxie18

Programmer
Feb 17, 2015
40
CA
Hi,

I have this code where I want to insert an optional field on an order detail but it won't let me set OEORDD.ORDUNIQ when I try to retrieve the order detail record:

Code:
adsOEORDH.Order = 0
adsOEORDH.Fields("ORDUNIQ").Value = adsXMBPICK.Fields("ORDUNIQ").Value
            
If adsOEORDH.Read Then
   adsOEORDD.Order = 0
   [COLOR=#EF2929]adsOEORDD.Fields("ORDUNIQ").Value = adsOEORDH.Fields("ORDUNIQ").Value 'OEORDD.ORDUNIQ value is always 0[/color]
   adsOEORDD.Fields("LINENUM").Value = adsXMBPICK.Fields("LINENUM").Value
                
   If adsOEORDD.Read Then
      adsOEORDDO.Fields("ORDUNIQ").Value = adsXMBPICK.Fields("ORDUNIQ").Value
      adsOEORDDO.Fields("LINENUM").Value = adsXMBPICK.Fields("LINENUM").Value
      adsOEORDDO.Fields("OPTFIELD").Value = "QTYPICKED"
                        
      If adsOEORDDO.Exists Then
         adsOEORDDO.Fields("VALIFMONEY").Value = adsXMBPICK.Fields("QTYPICKED").Value
         adsOEORDDO.Update
      Else
         adsOEORDDO.RecordGenerate False
         adsOEORDDO.Fields("ORDUNIQ").Value = adsXMBPICK.Fields("ORDUNIQ").Value
         adsOEORDDO.Fields("LINENUM").Value = adsXMBPICK.Fields("LINENUM").Value
         adsOEORDDO.Fields("OPTFIELD").Value = "QTYPICKED"
         adsOEORDDO.Fields("VALIFMONEY").Value = adsXMBPICK.Fields("QTYPICKED").Value
         adsOEORDDO.Insert
      End If
            
      adsOEORDD.Update
      adsOEORDH.Update
   End If
End If

What am I doing wrong or am I missing something?

Thanks in advance!
 
Sounds like it might be a composition error. You shouldn't need to set the ORDUNIQ value at all, just the LINENUM (and I'd use .PutWithoutVerification instead of assigning it to .Value). What do your view compositions look like?
 
Hi DjangMan,

I'm using the Accpac data source control for OEORDH, OEORDD and OEORDDO with Auto Compose set to true. Do I have to add all the data sources linked to those 3?

Thanks.
 
Record a macro, make your compositions like the recording. There is no "autocompose" feature.

Sage 300 Whisperer
 
I can't speak for how Auto Compose works. I've never used it and process everything through views. I'm am and am not a fan of binding data sources to views. The good is that it makes lots of development faster. The bad is that you're stuck having to do everything right where you might not be able to see what isn't right. The good about detaching your code is that you have full control, using the views and the bad is that you have to write more code.
 
Thanks for your inputs! Makes sense because on another project, I manually compose the views and it's working perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top