Guest User

Untitled

a guest
Jun 22nd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. Sub LoadParts(frmRptFilter)
  2. Dim sql
  3. Dim oParts
  4. Set oParts = CreateObject("ADODB.Recordset")
  5. oParts.Fields.Append "Part", adBSTR , 30
  6. oParts.Open
  7. oParts = window.opener.GetParts(oParts) 'Since oParts was passed as a parameter I did not believe this to be necessary, but when it didn't work as expected I tried returning it this way....didn't work either
  8. 'more code follows
  9.  
  10. Function GetParts(oParts)
  11. Dim sql
  12.  
  13. sql = "SELECT Job.Part_Number FROM Job RIGHT JOIN Packlist_Detail ON Packlist_Detail.Job = Job.Job "_
  14. & "WHERE Packlist_Detail.Packlist LIKE '" & sPL & "'"
  15.  
  16. CloseRS(oRS)
  17. oRS.Open sql, oConn, adOpenStatic, adLockReadOnly
  18.  
  19. oRS.MoveFirst
  20.  
  21. If Not (oRS.BOF AND oRS.EOF) Then
  22. Do while not oRS.EOF
  23. oParts.AddNew
  24. oParts("Part").Value = oRS(0)
  25. oParts.Update
  26. oRS.MoveNext
  27. Loop
  28. End If
  29.  
  30. 'GetParts = oParts 'Since oParts was passed as a parameter I did not believe this to be necessary, but when it didn't work as expected I tried returning it this way....didn't work either
  31. End Function
  32.  
  33. Set oParts = window.opener.GetParts(oParts)
  34.  
  35. Set GetParts = oParts
  36.  
  37. Set oParts = CreateObject("ADODB.Recordset")
  38. oParts.Fields.Append "Part", adBSTR , 30
  39. oParts.Open
Add Comment
Please, Sign In to add comment