0

After transferring a majority of my MS Access tables into Dataverse, I'm looking to transport this query as a DataSource for a Power Apps search box:

SELECT tblGCPC_ALL.ID, tblGCPC_ALL.DocumentNumber, tblGCPC_ALL.PONum AS [PO#], tblGCPC_ALL.Description, Nz([tbl_Vendors].[Vendor],"Pending") AS Vendor, tblGCPC_ALL.[J-Staff], tblGCPC_ALL.RemoteID, tblGCPC_ALL.Status, Nz([DateReceived],"Pending") AS Received, Nz([tblGCPC_ALL].[Receiver],"Pending") AS Receiver, tblGCPC_ALL.AssignedBuyer, IIf([Discrepancy]=0,"N","Y") AS Discr, Nz([tblGCPC_ALL].[REQ_ID],"N/A") AS REQ_ID, Mid([tblgcpc_all].[DocumentNumber],7,9) AS Expr1
FROM (tblGCPC_ALL LEFT JOIN q_VHUB_ALL ON tblGCPC_ALL.DocumentNumber = q_VHUB_ALL.VendorHolderID) LEFT JOIN tbl_Vendors ON q_VHUB_ALL.VendorID = tbl_Vendors.[Vendor ID]
WHERE (((tblGCPC_ALL.DocumentNumber) Is Not Null))
ORDER BY Mid([tblgcpc_all].[DocumentNumber],7,9) DESC;

The search box would only be about 1.5" long, but the dropdown datagrid that the query produces would produce a grid that is about 7" or more, wide.

Additionally, when the user searches in the box, the grid should grow or shrink depending on any qualified match of each column in the grid. Here is a sample of my KeyUp event in VBA for the search box:

Private Sub cboGCPC_Search_KeyUp(KeyCode As Integer, Shift As Integer)
   Dim strSQL As String

        strSQL = "SELECT * " _
               & "FROM SRCH_GCPC " _
               & "WHERE [DocumentNumber] Like '*" & Me.cboGCPC_Search.text & "*' OR [PO#] Like '*" & Me.cboGCPC_Search.text & "*' OR [Description] Like '*" & Me.cboGCPC_Search.text & "*' OR [Vendor] Like '*" & Me.cboGCPC_Search.text & "*' OR [Status] Like '*" & Me.cboGCPC_Search.text & "*' OR [Received] Like '*" & Me.cboGCPC_Search.text & "*' OR [Receiver] Like '*" & Me.cboGCPC_Search.text & "*' OR [J-Staff] Like '*" & Me.cboGCPC_Search.text & "*' OR [AssignedBuyer] Like '*" & Me.cboGCPC_Search.text & "*' OR [REQ_ID] Like '*" & Me.cboGCPC_Search.text & "*';"
               
        Select Case KeyCode

        Case 38, 40

            KeyCode = 0
            
        Case 1, 9, 13
            Exit Sub
            
        Case Else
            Me.cboGCPC_Search.RowSource = strSQL
            Me.cboGCPC_Search.Dropdown
        
        End Select
        
End Sub

MS Access also allows either showing or hiding the column headers as well as AutoExpand. I'm sure this should also be available in PowerFX

Because this a typical convention of something complex in MS Access and VBA, I feel that mimicking this exact type of functionality into a Power App would serve as template that covers a lot of questions for my migration.

June7
  • 19,874
  • 8
  • 24
  • 34
plateriot
  • 361
  • 5
  • 23
  • This question has example of PowerApps code manipulating combobox https://stackoverflow.com/questions/64928278/powerapps-dropdown-onchange-does-not-fire-if-its-filtered-with-textinput. Perhaps that will get your started. – June7 Feb 08 '23 at 23:05

0 Answers0