Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!
Public Function OriginPortTest(uMAID As Long, uRefNo As Long) As Boolean 'function to test the number of port of origin records for an item 'if the test returns true, then the user will be allowed to nominate a origin port otherwise, the default port record will be used Dim rs As New ADODB.Recordset Dim conn As Connection Set conn = CurrentProject.Connection Dim strSQL As String Dim vCount As Integer Dim vPodRecordCount 'Turn off warnings DoCmd.SetWarnings False strSQL = "SELECT DISTINCTROW MT_SKU_ANALYSIS.PORT_OF_LOAD " & _ "FROM MT_SKU_ANALYSIS GROUP BY MT_SKU_ANALYSIS.PORT_OF_LOAD, MT_SKU_ANALYSIS.MAID, MT_SKU_ANALYSIS.ITM_REF_NO " & _ "HAVING (((MT_SKU_ANALYSIS.PORT_OF_LOAD) Is Not Null) " & _ "And ((MT_SKU_ANALYSIS.MAID) =" & uMAID & ") And ((MT_SKU_ANALYSIS.ITM_REF_NO) =" & uRefNo & ")) " & _ "ORDER BY MT_SKU_ANALYSIS.PORT_OF_LOAD DESC" rs.Open strSQL, conn, adOpenKeyset, adLockOptimistic If rs.RecordCount > 0 Then rs.MoveFirst If IsNull(rs.Fields("PORT_OF_LOAD")) = True Then OriginPortTest = False 'only 1 port of load record found Else OriginPortTest = True 'more than 1 port of laod record found End If Else OriginPortTest = False 'no port of load found at all End If 'Debug.Print vPodRecordCount Set rs = Nothing DoCmd.SetWarnings True End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.