By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Set objOutlook = CreateObject("Outlook.Application")

P: 1
I keep getting this error ,
Set objOutlook = CreateObject("Outlook.Application").
I do not work in IT but no one seems to know how to fix this error. Someone please help me? I am the only one having this issue with trying to use the data base when I get to the sending the email. Someone said because I have both Micro soft office 15 & 16 on my computer its confused will that cause this issue If the developer only has the 15 version? Maybe I am wrong but it seems this issue has to do with outlook and If I have this issue others will end up with it in the future trying to use this data base.
Run-time error'-2147319779(8002801d)':

Automation error
Library not registered

Then when I click on debug the below message pops up.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Dim Hold_ID As Long
  3. Dim Finance_Approval_Required As Boolean
  4.  
  5.  
  6.  
  7. Public Function GetPath()
  8.     getpath2
  9. End Function
  10.  
  11. Public Sub getpath2()
  12.   DbPath = Application.CurrentProject.Path
  13. End Sub
  14.  
  15. Function Transfer_Text_to_Table(Spec_Name As String, Table_Name As String, FileIn_Name As String)
  16.  
  17. Dim FilePath_Name As String
  18.  
  19.   getpath2
  20.   FilePath_Name = DbPath & "\" & FileIn_Name
  21.  
  22. DoCmd.TransferText acImportDelim, Spec_Name, Table_Name, FilePath_Name
  23.  
  24. End Function
  25.  
  26. Public Function Excel2Access(Table_Name As String, Spreadsheet_Name As String)
  27. Dim FilePath_Name As String
  28.  
  29.   getpath2
  30.  
  31.   FilePath_Name = DbPath & "\" & Spreadsheet_Name
  32.  
  33.  
  34.   DoCmd.TransferSpreadsheet acImport, 8, Table_Name, FilePath_Name, True
  35.  
  36.  
  37. End Function
  38. Public Function Run_CC_EmailM(Email_Type As String, Email_ID As Long)
  39.  
  40.     Call Run_CC_Email(Email_Type, Email_ID)
  41. End Function
  42.  
  43. Public Sub Run_CC_Email(Email_Type As String, Email_ID As Long)
  44. ' On Error GoTo Err_Run_CC_Email
  45.  
  46.  
  47.     Dim objOutlook As Outlook.Application
  48.     Dim objMail As Outlook.MailItem
  49.  
  50.     Dim sSQL As String
  51.     Dim DB As DAO.Database
  52.     Dim Hold_Buyer As String
  53.     Dim Email_Buyer As String
  54.     Dim Hold_bodyLine1 As String
  55.     Dim Hold_CCRequest_info As String
  56.     Dim Hold_CCRequest_Count_Results As String
  57.     Dim Hold_Form As String
  58.  
  59.     Dim Hold_Date_Entered As String
  60.     Dim Hold_Date_Closed As String
  61.     Dim Hold_Request_by As String
  62.     Dim Hold_Part_Nbr As String
  63.     Dim Hold_Part_Description As String
  64.     Dim Hold_Reason As String
  65.     Dim Hold_Comments As String
  66.     Dim Hold_StdCost As Double
  67.     Dim Hold_Supplier As String
  68.     Dim Hold_Supply_Type As String
  69.     Dim hold_Item_Status As String
  70.     Dim hold_Planner As String
  71.     Dim Hold_AdHoc_Scheduled As String
  72.     Dim Hold_CC_Status As String
  73.     Dim Hold_Cycle_Count_Comments As String
  74.     Dim Hold_Finance_comments As String
  75.     Dim Hold_Adjust_Transfer As String
  76.     Dim sTitle As String, sFile As String, sErr As String
  77.     Dim rstDist As DAO.Recordset
  78.     Dim RstCCRequest As DAO.Recordset
  79.  
  80.     Set DB = CurrentDb
  81.  
  82.  
  83.     Set RstCCRequest = DB.OpenRecordset("TblCycleCountRequest", dbOpenDynaset)
  84.         RstCCRequest.FindFirst "[ID] = " & Email_ID
  85.  
  86.         Hold_Part_Nbr = Nz(RstCCRequest![Part Nbr], " ")
  87.         Hold_Part_Description = Nz(RstCCRequest![Description], " ")
  88.         Hold_Reason = Nz(RstCCRequest![Reason for Request], " ")
  89.         Hold_Comments = Nz(RstCCRequest![Request_Comments], " ")
  90.         Hold_StdCost = Nz(RstCCRequest![Standard Cost], " ")
  91.         Hold_Supplier = Nz(RstCCRequest![Supplier], " ")
  92.         hold_Item_Status = Nz(RstCCRequest![Item Status], " ")
  93.         hold_Planner = Nz(RstCCRequest![Planner Code], " ")
  94.         Hold_Date_Entered = Nz(RstCCRequest![Date Entered], " ")
  95.         Hold_CC_Status = Nz(RstCCRequest![CCReq_Status], " ")
  96.         Hold_AdHoc_Scheduled = Nz(RstCCRequest![Adhoc/Scheduled], " ")
  97.         Hold_Supply_Type = Nz(RstCCRequest![Supply Type], " ")
  98.         Hold_Date_Closed = Nz(RstCCRequest![CC_Date_Closed], " ")
  99.         Hold_Request_by = Nz(RstCCRequest![Requested By], " ")
  100.         Hold_Buyer = Nz(RstCCRequest![Buyer], " ")
  101.         Hold_Finance_comments = Nz(RstCCRequest![Finance Comments], " ")
  102.  
  103.         If Nz(RstCCRequest![Adjust_Transfer], " ") = 1 Then
  104.             Hold_Adjust_Transfer = "Adjust Oracle"
  105.         Else
  106.             If Nz(RstCCRequest![Adjust_Transfer], " ") = 2 Then
  107.                 Hold_Adjust_Transfer = "Transfer to REV/CCP"
  108.             Else
  109.                 Hold_Adjust_Transfer = Nz(RstCCRequest![Adjust_Transfer], " ")
  110.             End If
  111.        End If
  112.  
  113.         Hold_Cycle_Count_Comments = Nz(RstCCRequest![Cycle_Count_Comments], " ")
  114.  
  115.  
  116.    RstCCRequest.Close
  117.    Set RstCCRequest = Nothing
  118.  
  119.    'Prelims
  120.    DoCmd.SetWarnings False
  121.    DoCmd.Hourglass True
  122.  
  123.    Set DB = CurrentDb
  124.    sFile = " "
  125.  
  126. 'SELECT Email_Distribution.Email_Address, Email_Distribution.Email_Buyer, Email_Distribution.Email_Initial_CC_Request
  127. 'From Email_Distribution
  128. 'WHERE (((Email_Distribution.Email_Buyer)="Coates, Terence D")) OR (((Email_Distribution.Email_Initial_CC_Request)=True));
  129.  
  130.   '  If Email_Type = "Email_Initial_CC_Request" Or Email_Type = "Email_Final_CC_Results" Then
  131.         Email_Buyer = Hold_Buyer
  132.   '  Else
  133.   '      Email_Buyer = "xxxxxxxxx"
  134.   '  End If
  135.  
  136.          sSQL = "SELECT Email_Distribution.Email_Address, Email_Distribution.Email_Buyer, "
  137.          sSQL = sSQL & "Email_Distribution.Email_Initial_CC_Request "
  138.          sSQL = sSQL & "FROM Email_Distribution "
  139.          sSQL = sSQL & "WHERE(((Email_Distribution.Email_Buyer)='"
  140.          sSQL = sSQL & Email_Buyer & "')) OR (((Email_Distribution."
  141.          sSQL = sSQL & Email_Type & ")=True)"
  142.          sSQL = sSQL & ");"
  143.  
  144.          Set rstDist = DB.OpenRecordset(sSQL)
  145.  
  146.          If rstDist.EOF = True Then
  147.             sErr = "no entries in Email_distribution table"
  148.             MsgBox sErr, vbInformation + vbOKOnly
  149.          Else
  150.  
  151.  
  152.  
  153.             Set objOutlook = CreateObject("Outlook.Application")
  154.        'Prepare email message
  155.             Set objMail = objOutlook.CreateItem(olMailItem)
  156.             With objMail
  157.  
  158.         'Build recordset on recipients
  159.  
  160.  
  161.             rstDist.MoveFirst
  162.             While Not rstDist.EOF
  163.  
  164.             'Add Recipient
  165.  
  166.                 With .Recipients.Add(rstDist![Email_Address])
  167.                      .Type = olTo
  168.                 End With
  169.                 rstDist.MoveNext
  170.             Wend
  171.  
  172.             rstDist.Close
  173.             Set rstDist = Nothing
  174.  
  175.  
  176.     'Add the subject
  177.  
  178.             If Email_Type = "Email_Initial_CC_Request" Then
  179.                 .Subject = "Initial Cycle Count Request # " _
  180.                 & Email_ID & "          Part Number: " & Hold_Part_Nbr
  181.  
  182.                 Hold_bodyLine1 = "Please perform cycle count on following Part Number: " & _
  183.                 Hold_Part_Nbr & "    " & Hold_Part_Description & vbCrLf
  184.             Else
  185.                 If Email_Type = "Email_Organization_CC_Approval" Then
  186.                         .Subject = "Organization Approval required for Cycle Count Request # " _
  187.                          & Email_ID & "          Part Number: " & Hold_Part_Nbr
  188.  
  189.                     Hold_bodyLine1 = "Counts are complete on Cycle Count request # : " & _
  190.                     Email_ID & ".  Please review and approve in cycle count data base. " & vbCrLf
  191.  
  192.                 Else
  193.                     If Email_Type = "Email_Finance_CC_Approval" Then
  194.                         .Subject = "Finance Approval required for Cycle Count Request # " _
  195.                          & Email_ID & "          Part Number: " & Hold_Part_Nbr
  196.  
  197.  
  198.                      Hold_bodyLine1 = "Counts are complete on Cycle Count request # : " & _
  199.                      Email_ID & ".  Variance is greater than $2,500.  Please review and approve in cycle count data base. " & vbCrLf
  200.  
  201.                     Else
  202.                          If Email_Type = "Email_Final_CC_Results" Then
  203.                              .Subject = "Final results for Cycle Count Request # " _
  204.                              & Email_ID & "          Part Number: " & Hold_Part_Nbr
  205.  
  206.  
  207.                              Hold_bodyLine1 = "Counts and adjustments are complete on Cycle Count request # : " & _
  208.                              Email_ID & ".  Below are results: " & vbCrLf
  209.                         Else
  210.                              If Email_Type = "Email_Make_Adjustments" Then
  211.                                  .Subject = "Oracle adjustments required for Cycle Count Request # " _
  212.                                 & Email_ID & "          Part Number: " & Hold_Part_Nbr
  213.  
  214.  
  215.                                 Hold_bodyLine1 = "All approvals are complete on Cycle Count request # : " & _
  216.                                 Email_ID & ".  Please make necessary adjustments in Oracle and update CC database when complete " & vbCrLf
  217.                             End If
  218.                         End If
  219.                     End If
  220.                 End If
  221.            End If
  222.  
  223.             Hold_CCRequest_info = Hold_CCRequest_info & "Requested By: " & Hold_Request_by & vbCrLf
  224.             Hold_CCRequest_info = Hold_CCRequest_info & "Date Entered: " & Hold_Date_Entered & vbCrLf
  225.             Hold_CCRequest_info = Hold_CCRequest_info & "Reason for request: " & Hold_Reason & vbCrLf
  226.             Hold_CCRequest_info = Hold_CCRequest_info & "Requester Comments: " & Hold_Comments & vbCrLf
  227.             Hold_CCRequest_info = Hold_CCRequest_info & " " & vbCrLf
  228.             Hold_CCRequest_info = Hold_CCRequest_info & "Buyer           : " & Hold_Buyer & vbCrLf
  229.             Hold_CCRequest_info = Hold_CCRequest_info & "Std Cost       : " & Hold_StdCost & vbCrLf
  230.             Hold_CCRequest_info = Hold_CCRequest_info & "Supplier       : " & Hold_Supplier & vbCrLf
  231.             Hold_CCRequest_info = Hold_CCRequest_info & "Supply Type: " & Hold_Supply_Type & vbCrLf
  232.             Hold_CCRequest_info = Hold_CCRequest_info & "Planner        : " & hold_Planner & vbCrLf
  233.             Hold_CCRequest_info = Hold_CCRequest_info & "Item Status : " & Hold_CC_Status & vbCrLf
  234.             Hold_CCRequest_info = Hold_CCRequest_info & " " & vbCrLf
  235.             Hold_CCRequest_info = Hold_CCRequest_info & "Cycle Count Comments : " & Hold_Cycle_Count_Comments & vbCrLf
  236.             Hold_CCRequest_info = Hold_CCRequest_info & "Finance Comments : " & Hold_Finance_comments & vbCrLf
  237.             Hold_CCRequest_info = Hold_CCRequest_info & "Adjust or Transfer : " & Hold_Adjust_Transfer & vbCrLf
  238.  
  239.  
  240.  
  241.     'Add standard message text to body
  242.             .Body = .Body & Hold_bodyLine1 & vbCrLf
  243.             .Body = .Body & " " & vbCrLf
  244.             .Body = .Body & Hold_CCRequest_info & vbCrLf
  245.             .Body = .Body & " " & vbCrLf
  246.  
  247.  
  248.    'Closure
  249.             .Body = .Body & vbCrLf & "Thanks" & vbCrLf & vbCrLf & "Cycle Count Team" & vbCrLf
  250.             .Body = .Body & " " & vbCrLf
  251.             .Body = .Body & " " & vbCrLf
  252.  
  253.  
  254.       'Send the mail message
  255.             .Send
  256.  
  257.             End With
  258.  
  259.          End If
  260.  
  261.  
  262. Exit_Run_CC_Email:
  263.    DoCmd.SetWarnings True
  264.    DoCmd.Hourglass False
  265.    Exit Sub
  266.  
  267. Err_Run_CC_Email:
  268.    sErr = "Error " & Error & " / " & Err
  269.    MsgBox sErr, vbInformation + vbOKOnly, "Error on Email subroutine"
  270.    Resume Exit_Run_CC_Email
  271.  
  272. End Sub
  273.  
  274.  
  275.  
  276. Public Function Add_Subinventory_Recs()
  277.     Dim RstSubinventory As Recordset
  278.     Dim RstCCDetail As Recordset
  279.  
  280.     Dim DB As Database
  281.  
  282.      Set DB = CurrentDb
  283.      Set RstSubinventory = DB.OpenRecordset("CC_Subinventory")
  284.      Set RstCCDetail = DB.OpenRecordset("Tbl_CC_Detail")
  285.  
  286.      RstSubinventory.MoveFirst
  287.  
  288.      Do Until RstSubinventory.EOF
  289.          RstCCDetail.AddNew
  290.          RstCCDetail![CC_ID] = Forms!FrmNewCycleCountRequest![ID]
  291.          RstCCDetail![CC_Subinv] = RstSubinventory![CC_Subinventory_Name]
  292.          RstCCDetail.Update
  293.  
  294.          RstSubinventory.MoveNext
  295.     Loop
  296.  
  297.     RstCCDetail.Close
  298.     RstSubinventory.Close
  299.  
  300.     Set RstCCDetail = Nothing
  301.     Set RstSubinventory = Nothing
  302.  
  303. End Function
  304.  
  305. Public Function Calc_Count_Totals()
  306.     Dim RstCCDetail As DAO.Recordset
  307.     Dim RstMisc As DAO.Recordset
  308.     Dim DB As DAO.Database
  309.     Dim Tot_Oracle As Double
  310.     Dim Tot_Actual As Double
  311.     Dim Tot_Variance As Double
  312.  
  313.     Dim No_more_Match As Boolean
  314.     Dim Count_complete As Boolean
  315.     Dim New_Stat As String
  316.     Dim Hold_Finance_Limit
  317.     Dim Tot_Variance_Val As Double
  318.  
  319.  
  320.     Total_Oracle = 0
  321.     Total_Actual = 0
  322.     Total_Variance = 0
  323.     Total_Variance_Value = 0
  324.     No_more_Match = False
  325.     Count_complete = True
  326.  
  327.       Set DB = CurrentDb
  328.  
  329.       Set RstMisc = DB.OpenRecordset("Misc_Parameters", dbOpenDynaset)
  330.       RstMisc.MoveFirst
  331.       Hold_Finance_Limit = RstMisc![Finance_approve_limit]
  332.       RstMisc.Close
  333.       Set RstMisc = Nothing
  334.  
  335.  
  336.       Set RstCCDetail = DB.OpenRecordset("Tbl_CC_Detail", dbOpenDynaset)
  337.  
  338.       Hold_ID = Forms!FrmCycleCountRequest![ID]
  339.       RstCCDetail.FindFirst "CC_ID = " & Hold_ID
  340.  
  341.       If RstCCDetail.NoMatch Then
  342.         Forms!FrmCycleCountRequest!Frm_CC_Detail![TxtTotOracle] = Total_Oracle
  343.         Forms!FrmCycleCountRequest!Frm_CC_Detail![TxtTotActual] = Total_Actual
  344.         Forms!FrmCycleCountRequest!Frm_CC_Detail![TxtTotVariance] = Total_Variance
  345.         Forms!FrmCycleCountRequest!Frm_CC_Detail![TxtTotVarianceVal] = FormatCurrency(Total_variance_val, 2)
  346.  
  347.         Forms!FrmCycleCountRequest!Frm_CC_Detail![Lbl_Count_Complete].Visible = False
  348.  
  349.       Else
  350.         Do While No_more_Match = False
  351.  
  352.             Total_Oracle = Total_Oracle + RstCCDetail![CC_Oracle_Qty]
  353.             Total_Actual = Total_Actual + RstCCDetail![CC_Actual_Qty]
  354.             Total_Variance = Total_Variance + RstCCDetail![CC_Variance_Qty]
  355.             Total_variance_val = Total_variance_val + RstCCDetail![CC_Variance_Value]
  356.  
  357.             If Count_complete = True Then
  358.                 If IsNull(RstCCDetail![CC_Complete_Date]) Then
  359.                     Count_complete = False
  360.                 End If
  361.             End If
  362.  
  363.              RstCCDetail.MoveNext
  364.  
  365.              If RstCCDetail.EOF Then
  366.                 No_more_Match = True
  367.              Else
  368.                 If RstCCDetail![CC_ID] <> Hold_ID Then
  369.                     No_more_Match = True
  370.                 End If
  371.             End If
  372.         Loop
  373.  
  374.         Forms!FrmCycleCountRequest!Frm_CC_Detail![TxtTotOracle] = Total_Oracle
  375.         Forms!FrmCycleCountRequest!Frm_CC_Detail![TxtTotActual] = Total_Actual
  376.         Forms!FrmCycleCountRequest!Frm_CC_Detail![TxtTotVariance] = Total_Variance
  377.         Forms!FrmCycleCountRequest!Frm_CC_Detail![TxtTotVarianceVal] = FormatCurrency(Total_variance_val, 2)
  378.  
  379.       'Hide Finance Approval fields if variance value is less 5han specified Limit
  380.  
  381.         If Abs(Total_variance_val) >= Hold_Finance_Limit Then
  382.             Finance_Approval_Required = True
  383.             If Count_complete = True And (Forms!FrmCycleCountRequest![CCReq_Status] = "Counts Approved- Pending Finance Approval" _
  384.              Or Forms!FrmCycleCountRequest![CCReq_Status] = "Counts Approved- Pending Oracle Adjustment" _
  385.              Or Forms!FrmCycleCountRequest![CCReq_Status] = "CC Completed") Then
  386.                 Call Hide_Display_Finance_Approve("Display")
  387.             Else
  388.                 Call Hide_Display_Finance_Approve("Hide")
  389.             End If
  390.         Else
  391.             Finance_Approval_Required = False
  392.         End If
  393.  
  394.  
  395.         If Forms!FrmCycleCountRequest![CCReq_Status] = "Count in Process" And Count_complete = True Then
  396.             Forms!FrmCycleCountRequest!Frm_CC_Detail![Lbl_Count_Complete].Visible = True
  397.             New_Stat = "Complete"
  398.             Call Manage_Status(New_Stat)
  399.         End If
  400.  
  401.  
  402.  
  403.  
  404.     End If
  405.  
  406.     RstCCDetail.Close
  407.     Set RstCCDetail = Nothing
  408.  
  409. End Function
  410.  
  411. Public Function CCDetail_Calc_Variance()
  412.     Forms!FrmCycleCountRequest!Frm_CC_Detail![CC_Variance_Qty] = _
  413.     Forms!FrmCycleCountRequest!Frm_CC_Detail![CC_Oracle_Qty] - Forms!FrmCycleCountRequest!Frm_CC_Detail![CC_Actual_Qty]
  414.  
  415.     Forms!FrmCycleCountRequest!Frm_CC_Detail![CC_Variance_Value] = _
  416.     Forms!FrmCycleCountRequest!Frm_CC_Detail![CC_Variance_Qty] * Forms!FrmCycleCountRequest![Standard Cost]
  417.  
  418. End Function
  419.  
  420. Public Function Manage_Status(Change As String)
  421.     Dim RstCCRequest As Recordset
  422.     Dim DB As Database
  423.  
  424. '    Set DB = CurrentDb
  425. '    Set RstCCRequest = DB.OpenRecordset("TblCycleCountRequest")
  426.  
  427.  
  428.     Select Case Change
  429.         Case "InProcess"
  430.             Status_Hold = "Count in Process"
  431.         Case "Complete"
  432.             Status_Hold = "Initial Counts Complete/Pending Approval"
  433.             If MsgBox("OK to send email requesting Mgmt approval? ", vbInformation + vbYesNo) = vbNo Then
  434.                 Cancel = True
  435.             Else
  436.                 Forms!FrmCycleCountRequest![CCReq_Status] = Status_Hold
  437.                 Call Run_CC_Email("Email_Organization_CC_Approval", Hold_ID)
  438.                 Call Hide_Display_Mgmt_Approve("Display")
  439.                 Call Hide_Display_Finance_Approve("Hide")
  440.                 Call Hide_Display_Adjust("Hide")
  441.  
  442.             End If
  443.         Case "Approved-Mgmt"
  444.             Status_Hold = "Counts Approved- Pending Finance Approval"
  445.             If MsgBox("OK to send email requesting Fiance approval? ", vbInformation + vbYesNo) = vbNo Then
  446.                 Cancel = True
  447.             Else
  448.                 Forms!FrmCycleCountRequest![CCReq_Status] = Status_Hold
  449.                 Call Run_CC_Email("Email_Finance_CC_Approval", Hold_ID)
  450.                 Call Hide_Display_Mgmt_Approve("Display")
  451.                 Call Hide_Display_Finance_Approve("Display")
  452.                 Call Hide_Display_Adjust("Hide")
  453.  
  454.               End If
  455.         Case "Approved_Final"
  456.         Status_Hold = "Counts Approved- Pending Oracle Adjustment"
  457.         If MsgBox("OK to send email requesting Oracle adjustment? ", vbInformation + vbYesNo) = vbNo Then
  458.                Cancel = True
  459.             Else
  460.                 Forms!FrmCycleCountRequest![CCReq_Status] = Status_Hold
  461.                 Call Run_CC_Email("Email_Make_Adjustments", Hold_ID)
  462.                 Call Hide_Display_Mgmt_Approve("Display")
  463.                 Call Hide_Display_Finance_Approve("Display")
  464.                 Call Hide_Display_Adjust("Display")
  465.  
  466.              End If
  467.         Case "Done"
  468.             Status_Hold = "CC Completed"
  469.             Forms!FrmCycleCountRequest![CCReq_Status] = Status_Hold
  470.             Call Run_CC_Email("Email_Final_CC_Results", Hold_ID)
  471.         Case Else
  472.             MsgBox ("Case Else")
  473.         End Select
  474.  
  475. End Function
  476.  
  477.  
  478. Public Function Lock_Counts()
  479.      '    Forms!FrmCycleCountRequest!Frm_CC_Detail.Locked = True
  480. End Function
  481.  
  482.  
  483.  
  484. Public Function Lock_Approvals()
  485. '      Forms!FrmCycleCountRequest![CC_Approval_Initials].Locked = True
  486. '      Forms!FrmCycleCountRequest![Finance_Approve_Initials].Locked = True
  487. '      Forms!FrmCycleCountRequest![MFG Adjust].Locked = True
  488. '      Forms!FrmCycleCountRequest![US2 Adjust].Locked = True
  489.  
  490. End Function
  491.  
  492.  
  493.  
  494. Public Function Calc_Actual_Total()
  495.  
  496.     Dim RstActDetail As DAO.Recordset
  497.     Dim DB As DAO.Database
  498.     Dim Tot_Actual As Long
  499.     Dim No_more_Match As Boolean
  500.     Dim Hold_ID As String
  501.     Dim Hold_Subinv As String
  502.  
  503.     Tot_Actual = 0
  504.     No_more_Match = False
  505.  
  506.       Set DB = CurrentDb
  507.  
  508.       Set RstActDetail = DB.OpenRecordset("Actual_Subinv_Count_Detail", dbOpenDynaset)
  509.  
  510.  
  511.       Hold_ID = Forms!Actual_Subinv_Count_Detail![TxtCC_ID]
  512.       Hold_Subinv = Forms!Actual_Subinv_Count_Detail![TxtSubInv]
  513.  
  514.       RstActDetail.FindFirst "[Actual_ID] =  '" & Hold_ID & "' AND Actual_Subin = '" & Hold_Subinv & "'"
  515.  
  516.       If RstActDetail.NoMatch Then
  517.  
  518.         Forms!Actual_Subinv_Count_Detail![TxtAct_Det_Tot] = Tot_Actual
  519.       Else
  520.         Do While No_more_Match = False
  521.  
  522.         Tot_Actual = Tot_Actual + RstActDetail![Actual_Count]
  523.  
  524.         RstActDetail.MoveNext
  525.  
  526.         If RstActDetail.EOF Then
  527.                 No_more_Match = True
  528.              Else
  529.                 If RstActDetail![Actual_ID] <> Hold_ID Or RstActDetail![Actual_Subin] <> Hold_Subinv Then
  530.                     No_more_Match = True
  531.                 End If
  532.             End If
  533.  
  534.  
  535.         Loop
  536.  
  537.     Forms!Actual_Subinv_Count_Detail![TxtAct_Det_Tot] = Tot_Actual
  538.  
  539.  
  540.      End If
  541.  
  542.  
  543.     RstActDetail.Close
  544.     Set RstActDetail = Nothing
  545.  
  546. End Function
  547.  
  548.  
  549. Public Function Hide_Display_Mgmt_Approve(Action As String)
  550.  Dim True_False As Boolean
  551.  
  552.     If Action = "Hide" Then
  553.         True_False = False
  554.     Else
  555.         True_False = True
  556.     End If
  557.  
  558.     Forms!FrmCycleCountRequest![CC_Approval_Initials].Visible = True_False
  559.     Forms!FrmCycleCountRequest![CC_Approval_Date].Visible = True_False
  560.     Forms!FrmCycleCountRequest![Label66].Visible = True_False
  561.  
  562. End Function
  563.  
  564. Public Function Hide_Display_Finance_Approve(Action As String)
  565.  Dim True_False As Boolean
  566.  
  567.     If Action = "Hide" Then
  568.         True_False = False
  569.     Else
  570.         True_False = True
  571.     End If
  572.  
  573.             Forms!FrmCycleCountRequest![Finance_Approve_Initials].Visible = True_False
  574.             Forms!FrmCycleCountRequest![Finance_Approve_Date].Visible = True_False
  575.             Forms!FrmCycleCountRequest![TxtFinance_Comm].Visible = True_False
  576.             Forms!FrmCycleCountRequest![Frame70].Visible = True_False
  577.             Forms!FrmCycleCountRequest![Label67].Visible = True_False
  578.  
  579.  
  580. End Function
  581.  
  582. Public Function Hide_Display_Adjust(Action As String)
  583.     Dim True_False As Boolean
  584.  
  585.     If Action = "Hide" Then
  586.         True_False = False
  587.     Else
  588.         True_False = True
  589.     End If
  590.  
  591.             Forms!FrmCycleCountRequest![MFG Adjust].Visible = True_False
  592.             Forms!FrmCycleCountRequest![US2 Adjust].Visible = True_False
  593.             Forms!FrmCycleCountRequest![Adjustments Complete].Visible = True_False
  594. End Function
  595.  
  596.  
  597.  
  598. Public Function Process_Mgmt_Approval()
  599.     If IsNull(Forms!FrmCycleCountRequest![CC_Approval_Date]) Then
  600.       If Not IsNull(Forms!FrmCycleCountRequest![CC_Approval_Initials]) Then
  601.             Forms!FrmCycleCountRequest![CC_Approval_Date] = Date
  602.  
  603.             If Finance_Approval_Required = True Then
  604.                 Call Manage_Status("Approved-Mgmt")
  605.             Else
  606.                 Call Manage_Status("Approved_Final")
  607.             End If
  608.  
  609.       End If
  610. End If
  611.  
  612.  
  613. End Function
2 Weeks Ago #1
Share this Question
Share on Google+
3 Replies


twinnyfo
Expert Mod 2.5K+
P: 3,158
LorettaD,

Welcome to Bytes!

My hunch is that the MS Office 15 & 16 may be the issue. I can't tell which references your code is looking for. When you click on debug (which, from a DBA perspective, you should never be able to get there as a user) and your VBA editor opens, if you go to Tools | References, it will tell you whick MS Outlook Object Library the DB is looking for. You can share that with us, if you wish.

Honestly, though, this should not be your place to fix this DB. Whoever built it should be the one to ensure all users are able to perform their requisite tasks. There are different way to automate Outlook--which can be helpful, particularly if certain users have different versions of MS Office.

Not sure I hepped a whole heap, but maybe this could point your IT folks in the right direction of fixing this issue for you.

Let us know how you come along....
2 Weeks Ago #2

ADezii
Expert 5K+
P: 8,616
Change Code Line# 153
Expand|Select|Wrap|Line Numbers
  1. Set objOutlook = CreateObject("Outlook.Application")
to
Expand|Select|Wrap|Line Numbers
  1. Set objOutlook = New Outlook.Application
and see what happens.
2 Weeks Ago #3

zmbd
Expert Mod 5K+
P: 5,331
LorettaD

+ Can you open Outlook on your PC directly; if so, what version of Outlook opens on your PC?

+ What version of Access opens on your PC?

What can happen with multiple versions of Office on a PC is that the installation can become corrupted, especially with Outlook - it is intended to have only one version installed. Microsoft's on documentation points this out.

https://support.office.com/en-us/art...7-b78c513788bf
2 Weeks Ago #4

Post your reply

Sign in to post your reply or Sign up for a free account.